Skip to content

Portal metadata and search

The ArcGISPortal class is the entry point to the portal services hosted by ArcGIS Online and ArcGIS Enterprise. An ArcGISPortal instance provides access to the portal's information, including its name, URL, and other metadata. You can also use it to search for the PortalItems and PortalGroups that the portal contains.

The most common workflow for a ArcGIS Maps SDK for .NET app focuses on portal items, including searching for items, retrieving item details, managing items, and displaying items as web maps, web scenes, and galleries. The use of the PortalUser and PortalGroup classes is typically secondary, as these classes are primarily used to find items associated with the a user or a group. The tasks of creating and managing users and groups is performed through the ArcGIS Online or ArcGIS Enterprise web interface or an automation script that uses the ArcGIS Python API.

Create a portal instance

Start by creating an instance of the ArcGISPortal class, passing the URL of the portal and whether the user needs to log in to the portal (authenticated access) or not (anonymous access).

Portal properties

ArcGISPortal provides components applicable to the portal as a whole via such functions as:

The ArcGISPortal.User property returns the current user in the case of authenticated access. In the case of anonymous access, it returns null. The property is of type PortalUser.

Portal info

While ArcGISPortal contains many properties to describe basic information about the portal, it also exposes the PortalInfo class to provide additional metadata for the portal. You can access this metadata from the ArcGISPortal.PortalInfo property. The PortalInfo class exposes information about the organization, including: default basemaps and extent to use when creating new maps, the thumbnail and banner images displayed on the organization page, a variety of query strings you can use to query groups, and more.

Search for portal items and groups

The ArcGISPortal class enables you to search for portal items and portal groups. You can use ArcGISPortal.FindItemsAsync() to find items based on various criteria, such as keywords, tags, and owner. Similarly, ArcGISPortal.FindGroupsAsync() allows you to find groups within the portal. Both methods take a PortalQueryParameters as a parameter.

The key to using PortalQueryParameters effectively is to understand how to create an object of the class.

Call the appropriate factory method to create query parameters suited to your search:

Search for items in a group

You can search for portal items that belong to a specific group using the PortalGroup class. The PortalGroup.FindItemsAsync() method takes a PortalGroupContentSearchParameters instance.

You can use the appropriate factory method to create query parameters suited to your search:

You can also construct the search parameters with PortalGroupContentSearchParameters() to craft a query string to find items in the group.

There are several ways to obtain a PortalGroup instance. If you know the group ID, you can instantiate PortalGroup using its ID. To find a specific group that the current user belongs to, use the PortalUser.Groups property to get a list of all the user's groups. You can then iterate through the list to find the group you want.

Search for items by user

You can search for portal items by PortalUser. To find items owned by a user, callPortalUser.GetContentAsync(). This returns a PortalUserContent object representing the content (folders and items) owned by the user. Its properties include:

You can then iterate over the collection of subfolders. For each subfolder, call PortalUser.GetContentInFolderAsync() and pass in the subfolder name to retrieve the portal items in the folder.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.