ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Core Namespace / Project Class / SaveEditsAsync Method
Example

In This Topic
    SaveEditsAsync Method
    In This Topic
    Save all unsaved data edits in the project
    Syntax
    public Task<bool> SaveEditsAsync()
    Public Function SaveEditsAsync() As Task(Of Boolean)

    Return Value

    true if the save succeeds
    Example
    Disable Editing
    // if editing
    if (Project.Current.IsEditingEnabled)
    {
      var res = MessageBox.Show("Do you want to disable editing? Editing tools will be disabled",
                                                             "Disable Editing?", System.Windows.MessageBoxButton.YesNoCancel);
      if (res == System.Windows.MessageBoxResult.No ||
                    res == System.Windows.MessageBoxResult.Cancel)
      {
        return;
      }
    
      //we must check for edits
      if (Project.Current.HasEdits)
      {
        res = MessageBox.Show("Save edits?", "Save Edits?", System.Windows.MessageBoxButton.YesNoCancel);
        if (res == System.Windows.MessageBoxResult.Cancel)
          return;
        else if (res == System.Windows.MessageBoxResult.No)
          Project.Current.DiscardEditsAsync();
        else
        {
          Project.Current.SaveEditsAsync();
        }
      }
      Project.Current.SetIsEditingEnabledAsync(false);
    }
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also