ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Core Namespace / ApplicationOptions Class / GeneralOptions Property
Example

In This Topic
    GeneralOptions Property
    In This Topic
    Gets the available application general options.
    Syntax
    Public Shared ReadOnly Property GeneralOptions As GeneralOptions
    public static GeneralOptions GeneralOptions {get;}
    Example
    Get GeneralOptions
    {
      var startMode = ApplicationOptions.GeneralOptions.StartupOption;
      var aprx_path = ApplicationOptions.GeneralOptions.StartupProjectPath;
    
      var hf_option = ApplicationOptions.GeneralOptions.HomeFolderOption;
      var folder = ApplicationOptions.GeneralOptions.CustomHomeFolder;
    
      var gdb_option = ApplicationOptions.GeneralOptions.DefaultGeodatabaseOption;
      var def_gdb = ApplicationOptions.GeneralOptions.CustomDefaultGeodatabase;
    
      var tbx_option = ApplicationOptions.GeneralOptions.DefaultToolboxOption;
      var def_tbx = ApplicationOptions.GeneralOptions.CustomDefaultToolbox;
    
      var create_in_folder = ApplicationOptions.GeneralOptions.ProjectCreateInFolder;
    }
    Set GeneralOptions to Use Custom Settings
    {
      //Set the application to use a custom project, home folder, gdb, and toolbox
      //In each case, the custom _path_ must be set _first_ before 
      //setting the "option". This ensures the application remains 
      //in a consistent state. This is the same behavior as on the Pro UI.
      if (string.IsNullOrEmpty(ApplicationOptions.GeneralOptions.StartupProjectPath))
        ApplicationOptions.GeneralOptions.StartupProjectPath = @"D:\data\usa.aprx";//custom project path first
      ApplicationOptions.GeneralOptions.StartupOption = StartProjectMode.WithDefaultProject;//option to use it second
    
      if (string.IsNullOrEmpty(ApplicationOptions.GeneralOptions.CustomHomeFolder))
        ApplicationOptions.GeneralOptions.CustomHomeFolder = @"D:\home_folder";//custom home folder first
      ApplicationOptions.GeneralOptions.HomeFolderOption = OptionSetting.UseCustom;//option to use it second
    
      if (string.IsNullOrEmpty(ApplicationOptions.GeneralOptions.CustomDefaultGeodatabase))
        ApplicationOptions.GeneralOptions.CustomDefaultGeodatabase = @"D:\data\usa.gdb";//custom gdb path first
      ApplicationOptions.GeneralOptions.DefaultGeodatabaseOption = OptionSetting.UseCustom;//option to use it second
    
      if (string.IsNullOrEmpty(ApplicationOptions.GeneralOptions.CustomDefaultToolbox))
        ApplicationOptions.GeneralOptions.CustomDefaultToolbox = @"D:\data\usa.tbx";//custom toolbox path first
      ApplicationOptions.GeneralOptions.DefaultToolboxOption = OptionSetting.UseCustom;//option to use it second
    }
    Set GeneralOptions to Use Defaults
    {
      //Default options can be set regardless of the value of the "companion"
      //path (to a project, folder, gdb, toolbox, etc.). The path value is ignored if
      //the option setting does not use it. This is the same behavior as on the Pro UI.
      ApplicationOptions.GeneralOptions.StartupOption = StartProjectMode.ShowStartPage;
      ApplicationOptions.GeneralOptions.HomeFolderOption = OptionSetting.UseDefault;
      ApplicationOptions.GeneralOptions.DefaultGeodatabaseOption = OptionSetting.UseDefault;
      ApplicationOptions.GeneralOptions.DefaultToolboxOption = OptionSetting.UseDefault;//set default option first
    
      //path values can (optionally) be set (back) to null if their 
      //"companion" option setting is the default option.
      if (ApplicationOptions.GeneralOptions.StartupOption != StartProjectMode.WithDefaultProject)
        ApplicationOptions.GeneralOptions.StartupProjectPath = null;
      if (ApplicationOptions.GeneralOptions.HomeFolderOption == OptionSetting.UseDefault)
        ApplicationOptions.GeneralOptions.CustomHomeFolder = null;
      if (ApplicationOptions.GeneralOptions.DefaultGeodatabaseOption == OptionSetting.UseDefault)
        ApplicationOptions.GeneralOptions.CustomDefaultGeodatabase = null;
      if (ApplicationOptions.GeneralOptions.DefaultToolboxOption == OptionSetting.UseDefault)
        ApplicationOptions.GeneralOptions.CustomDefaultToolbox = null;
    }
    Get/Set Portal Project Options
    {
      // access the current options
      var def_home = ApplicationOptions.GeneralOptions.PortalProjectCustomHomeFolder;
      var def_gdb = ApplicationOptions.GeneralOptions.PortalProjectCustomDefaultGeodatabase;
      var def_tbx = ApplicationOptions.GeneralOptions.PortalProjectCustomDefaultToolbox;
      var deleteOnClose = ApplicationOptions.GeneralOptions.PortalProjectDeleteLocalCopyOnClose;
      var def_location = ApplicationOptions.GeneralOptions.PortalProjectDownloadLocation;
    
      // set the options
      ApplicationOptions.GeneralOptions.PortalProjectCustomHomeFolder = @"E:\data";
      ApplicationOptions.GeneralOptions.PortalProjectCustomDefaultGeodatabase = @"E:\data\usa.gdb";
      ApplicationOptions.GeneralOptions.PortalProjectCustomDefaultToolbox = @"E:\data\usa.tbx";
      ApplicationOptions.GeneralOptions.PortalProjectDeleteLocalCopyOnClose = false;
      ApplicationOptions.GeneralOptions.PortalProjectDownloadLocation = @"E:\data";
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also