Skip to content

Portal items

A PortalItem can be a web map, web scene, layer, file, application or other types of content in an ArcGIS Online or ArcGIS Enterprise portal. With this class, you can access various properties of the portal item, such as item ID, description, URL, access level, owner, type, and more. Additionally, it has certain properties that apply only to specific portal item types, such as an extent property for web maps and scenes and a URL property for layers sourced from a service.

Create a portal item

Unlike portal users or portal groups, which cannot be created or managed within a ArcGIS Maps SDK for Qt app, portal items can be created, updated, and deleted in such an app. Most of the constructors create an instance that represents an item that already exists in the portal.

One constructor, however, allows you to create a new, empty portal item by instantiating the PortalItem class and passing the Portal along with information that defines the new item.

You can add content to your new PortalItem instance by calling PortalItem::updateDataWithJsonAsync(), which allows you to udpate a portal item with new content.

Finally, you can add the new portal item to the ArcGIS Online or ArcGIS Enterprise portal by calling the addPortalItemWithJsonAsync() on the PortalUser, which can be retrieved from Portal::portalUser(). Pass the new portal item to PortalUser::addPortalItemWithJsonAsync().

Access levels

A portal item can have one of several access levels to control the visibility and editability of portal items, ensuring that sensitive information is only accessible to authorized users. The primary PortalAccess levels are:

  • Private: Only the owner can view or edit the item.
  • Organization: Only members of the organization can view the item.
  • Public: Anyone can view the item.

Shared access level

The fourth access level is Shared and results from a portal item being shared with one or more groups. This access level is not a standalone access level but rather a combination of the item's access level and the groups with which it is shared. It has different effects depending on the primary access level of the item itself.

  • If a private item is shared with a group, it will be accessible to members of that group and the item owner, but remain private to everyone else.

  • If an organization item is shared with a group, it will be accessible to members of that group and the organization, but remain private to everyone else.

  • If a public item is shared with a group, it will be accessible to members of that group and the public. Although a public item is, by definition, accessible to everyone, the advantage to sharing it with a group is that group members will be able to conveniently find and access items relevant to their work, enhancing collaboration.

Sharing a portal item

The PortalItem::access() property contains the current access level of the portal item. If multiple access levels have been assigned, this property returns only the most permissive level, indicating the widest potential audience that has access to the item.

If you want to change the access level of a portal item, the following steps are recommended:

  1. Call PortalItem::shareWithAsync() and pass in the boolean values for the everyone and organization parameters as shown in the table below.

    everyoneorganizationresult
    truetrueSets access level to public.
    falsetrueSets access level to organization.
    falsefalseSets access level to private.
  2. Call PortalItem::shareWithGroupsAsync() and pass in a collection of the IDs of the groups you want to share the item with.

Stop sharing an item

You can also stop all sharing of an item by calling PortalItem::unshareAsync(). Alternatively, you can stop sharing an item with specific groups by calling PortalItem::unshareGroupsAsync() and passing in the a collection of group IDs.

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