ArcGIS Pro 3.6 API Reference Guide
ArcGIS.Desktop.Core Namespace / Project Class / Current Property
Example

In This Topic
    Current Property (Project)
    In This Topic
    Gets the project that is currently open in the ArcGIS Pro application
    Syntax
    public static Project Current {get;}
    Public Shared ReadOnly Property Current As Project
    Remarks

    Only one project can be opened at a time in ArcGIS Pro. When another project is opened or a new project is created, this property is updated to reflect the newly opened project.

    Example
    Get the Current project
    //Gets the current project
    var project = Project.Current;
    Get location of current project
    //Gets the location of the current project; that is, the path to the current project file (*.aprx)  
    string projectPath = Project.Current.URI;
    Get the project's default gdb path
    var projGDBPath = Project.Current.DefaultGeodatabasePath;
    Check if project needs to be saved
    //The project's dirty state indicates changes made to the project have not yet been saved. 
    bool isProjectDirty = Project.Current.IsDirty;
    Determine if the project is a portal project from a project's path
     // A portal project path looks like this:
     //@"https://<ServerName>.<Domain>.com/portal/sharing/rest/content/items/1a434faebbe7424d9982f57d00223baa";
     //A local project path looks like this:
     //@"C:\Users\<UserName>\Documents\ArcGIS\Projects\MyProject\MyProject.aprx";
     bool isPortalProject = Uri.TryCreate(projectPath, UriKind.Absolute, out Uri uriResult)
    && (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps);
    
     if (isPortalProject)
     {
       System.Diagnostics.Debug.WriteLine("This is a portal project");
     }
     else
     {
       System.Diagnostics.Debug.WriteLine("This is not a portal project");
     }
    Determine if the project is a portal project from a project object
    var isPortalProject2 = Project.Current.IsPortalProject;
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also