ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Core Namespace / Project Class / IsPortalProject Property
Example

In This Topic
    IsPortalProject Property
    In This Topic
    If true, this project is a portal project.
    Syntax
    Public ReadOnly Property IsPortalProject As Boolean
    public bool IsPortalProject {get;}
    Example
    Determine if the project is a portal project from a project's path
    {
      projectPath = Project.Current.Url;
      // 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");
      }
      // Use isPortalProject;
    }
    Determine if the project is a portal project from a project object
    {
      var isPortalProject = Project.Current.IsPortalProject;
      // Use isPortalProject; 
    }
    Requirements

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

    ArcGIS Pro version: 3.3 or higher.
    See Also