The Portal
class is the entry point to the portal services hosted by ArcGIS Online and ArcGIS Enterprise. A Portal
instance provides access to the portal's information, including its name, URL, and other metadata. You can also use it to search for the PortalItem
s and PortalGroup
s that the portal contains.
The most common workflow for a ArcGIS Maps SDK for Qt 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 Portal
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
Portal
provides components applicable to the portal as a whole via such functions as:
-
fetchBasemapsAsync()
-
fetchFeaturedGroupsAsync()
-
fetchFeaturedItemsAsync()
-
fetchStylesAsync()
-
fetchSymbolSetsAsync()
The Portal::portalUser()
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 Portal
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 Portal::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 Portal
class enables you to search for portal items and portal groups. You can use Portal::findItemsAsync()
to find items based on various criteria, such as keywords, tags, and owner. Similarly, Portal::findGroupsAsync()
allows you to find groups within the portal. Both methods take a subclass of PortalQueryParameters
as a parameter.
The key to using PortalQueryParameters
effectively is to understand which subclass of PortalQueryParameters
to instantiate.
- Instantiate
PortalQueryParametersForGroups
and pass strings for owner and title when searching for groups that have a specific owner and title. You can set properties on the instance you just created to customize it further. - Instantiate
PortalQueryParametersForItems
with the constructor that does not take any parameters. You can set properties on the instance you just created to customize it further. For example, you could callset
when searching for items of any one of a collection ofTypes() PortalItemType
s. - You can further restrict the search by calling
set
,Owner() set
and/orGroup Id() set
on aSearch String() PortalQueryParametersForGroups
orPortalQueryParametersForItems
object.
Pass the PortalQueryParametersForGroups
or PortalQueryParametersForItems
instance to the Portal::findGroupsAsync()
or Portal::findItemsAsync()
, respectively, to execute the search.
Search for items by user
You can search for portal items by PortalUser
. To find items owned by a user, call PortalUser::fetchContentAsync()
. The content is made up of lists of PortalItem
s and PortalFolder
s.
You can then iterate over the collection of subfolders. For each subfolder, call PortalUser::fetchContentInFolderAsync()
and pass in the subfolder name to retrieve the portal items in the folder.