ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / MapMember Class / SetUseSourceMetadata Method
True to use its underlying source object's metadata
Example

In This Topic
    SetUseSourceMetadata Method (MapMember)
    In This Topic
    Sets whether or not the MapMember will use its own metadata or the metadata from its underyling source (if it has one). This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public virtual void SetUseSourceMetadata( 
       bool useSource
    )
    Public Overridable Sub SetUseSourceMetadata( _
       ByVal useSource As Boolean _
    ) 

    Parameters

    useSource
    True to use its underlying source object's metadata
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    Layer Metadata
    MapMember mapMember = map.GetLayersAsFlattenedList().FirstOrDefault(); //Search for only layers/tables here if needed.
    if (mapMember == null) return;
    
    //Gets whether or not the MapMember stores its own metadata or uses metadata retrieved
    //from its source. This method must be called on the MCT. Use QueuedTask.Run
    bool doesUseSourceMetadata = mapMember.GetUseSourceMetadata();
    
    //Sets whether or not the MapMember will use its own metadata or the metadata from
    //its underyling source (if it has one). This method must be called on the MCT.
    //Use QueuedTask.Run
    mapMember.SetUseSourceMetadata(true);
    
    //Does the MapMember supports metadata
    var supportsMetadata = mapMember.SupportsMetadata;
    
    //Get MapMember metadata
    var metadatstring = mapMember.GetMetadata();
    //TODO:Make edits to metadata using the retrieved mapMetadata string.
    
    //Set the modified metadata back to the mapmember (layer, table..)
    if (mapMember.GetCanEditMetadata())
      mapMember.SetMetadata(metadatstring);
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also