ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Core Namespace / Project Class / SetIsEditingEnabledAsync Method
True if editing is to be enabled, false if editing is to be disabled.
Example

In This Topic
    SetIsEditingEnabledAsync Method
    In This Topic
    Sets a value that indicates if editing is to be enabled or disabled within the application.
    Syntax
    Public Function SetIsEditingEnabledAsync( _
       ByVal value As Boolean _
    ) As Task(Of Boolean)
    public Task<bool> SetIsEditingEnabledAsync( 
       bool value
    )

    Parameters

    value
    True if editing is to be enabled, false if editing is to be disabled.

    Return Value

    A task representing a value indicating if the method was successful.
    Remarks
    Use this method to enable or disable editing within the application. Setting this value is independent of the visibility of the Enable/Disable editing control on the Edit Tab (see EditingOptions.EnableEditingFromEditTab. If the project has unsaved edits, setting this value to false will not succeed, those edits must be saved or discarded first (see HasEdits to determine if the project has unsaved edits). Use the IsEditingEnabled property to determine if editing is enabled or disabled within the application.
    Example
    Enable Editing
    // Enables editing for the current project asynchronously.
    if (!Project.Current.IsEditingEnabled)
    {
      var bEditingIsEnabled = await Project.Current.SetIsEditingEnabledAsync(true);
    }
    Disable Editing
    // Disables editing for the current project.
    // discard any edits if they exist
    var discardEdits = true;
    // only needed if editing is enabled
    if (Project.Current.IsEditingEnabled)
    {
      // check for edits
      if (Project.Current.HasEdits)
      {
        if (discardEdits)
          await Project.Current.DiscardEditsAsync();
        else
          await Project.Current.SaveEditsAsync();
      }
      var bEditingIsEnabled = !Project.Current.SetIsEditingEnabledAsync(false).Result;
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also