ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Core Namespace / Item Class / CanEdit Method
Example

In This Topic
    CanEdit Method (Item)
    In This Topic
    Indicates if metadata is editable for the item. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Function CanEdit() As Boolean
    public bool CanEdit()

    Return Value

    true if the metadata can be edited
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    Item: Set the metadata of an item: SetXML
    {
      // Note: Needs QueuedTask to run
      var xmlMetadata = File.ReadAllText(@"E:\Data\Metadata\MetadataForFeatClass.xml");
      //Will throw InvalidOperationException if the metadata cannot be changed
      //so check "CanEdit" first
      if (featureClassMetadataItem.CanEdit())
        featureClassMetadataItem.SetXml(xmlMetadata);
    }
    Item: Check the metadata can be edited: CanEdit
    {
      bool canEdit;
      //Call CanEdit before calling SetXml
      // Note: Needs QueuedTask to run
      canEdit = metadataItemToCheck.CanEdit();
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also