ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Core Namespace / Project Class / HasEdits Property
Example

In This Topic
    HasEdits Property
    In This Topic
    Gets if there are any unsaved data edits in the project
    Syntax
    public bool HasEdits {get;}
    Public ReadOnly Property HasEdits As Boolean
    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