Add items to a portal

In this topic

Portals, such as ArcGIS Online and ArcGIS Enterprise, can store many types of items.
Most types are directly related to the ArcGIS platform, including ArcGIS documents (.mxd, .3dd, .mapx), datasets and packages (.lyr, .kml, .tpk), service urls, and so on. You can also store things like Microsoft Office documents (.docx, .pptx, .xlsx), comma-separated values (.csv), portable document format (.pdf), and a variety of image formats (.jpg, .png, .tif). Perhaps the most familiar type of portal item is a web map — a JSON description of the data in a map, along with other display and behavioral
properties. Web maps are particularly useful in your ArcGIS Runtime SDK apps, as they provide a way for you to display a consistent set of data and symbology to your users. Portal items also offer the ability to make and save changes to these items, if needed.

The
AGSPortalItem class represents an individual item stored in a portal. Each item
includes the following:

Binary or text-based data—for example, the JSON that defines a web map or a feature collection, or a URL pointing to a map service, or the binary data of a tile package or shapefile

Sharing settings—the access level and groups to whom the item is accessible

This topic will describe creating new portal items in general, setting common properties, and adding them to a portal. For information specific to working with web map portal items, see the Display a map and Save a map topics. For information about setting the right access level for your items, see Share a portal item.

Create a new portal item

A new portal item must be created in the context of a particular portal, such as your ArcGIS Online organization. The user connecting to the portal must also have permissions to create new items. See the Access the ArcGIS Platform topic for information about connecting to a portal as an authenticated user.
Once you've connected to your portal, you can create a new portal item by specifying the portal on which it will be hosted, the type of data it will store, and a name (title) to display for the item. The item content must be specified when initially adding the item to the portal. A new portal item can be added to the root folder, or to any available subfolder for the currently authenticated user.

The following example creates a new portal item called "TES Species Summary" that will store a PDF document. It sets properties to provide a summary (short description), a description, and a set of tags to improve searchability and it provides a PDF file to the AGSPortalItemContentsParameters. The code then adds the new item to the root folder on the user's portal.

When adding a new item to a portal, you can specify a subfolder in which to store the item. The available subfolders are those that belong to the currently connected portal user. The following example gets a list of the available subfolders in which a new portal item can be stored.

Update a portal item

A portal item can have content that is based on simple text or on binary data. The content for a portal item may be read from a local file as text (for a CSV item, for example), as binary data (for an image file, for example), or simply set with a URL (for GIS services). You assign content to a portal item when initially adding it to the portal (AddPortalItem) and you can update a portal item's content later using UpdateData, as shown in the following example.

For best results, a thumbnail image should be 200 pixels wide by 133 pixels
high (other sizes will be adjusted to fit). Acceptable thumbnail image formats
are: PNG, GIF and JPEG.
The maximum file size is 1Mb

Note:

Changes to the portal item metadata, such as its title, summary, description, and so on can be updated by calling the updateItemPropertiesWithCompletion method. Call updateData to update the item's file and call updateJSON to update the item's JSON data.

Note:

Changes to the portal item metadata, such as its title, summary, description, and so on can be updated by calling the updateItemPropertiesAsync method. Call updateDataAsync to update the item's JSON data.

Set sharing

When a user creates a new portal item (using ArcGIS Online or an ArcGIS Runtime API) its accessibility is private by default, meaning only the owner of the item (and the organization's administrators) are able to view it. If you choose to, you can share your portal item with:

The creator of the item and portal administrators

Your entire organization

Specified portal groups

Everyone

Note:

To control sharing for an item, you must be able to connect to the portal as an authenticated user with the appropriate permissions (the item owner or a portal administrator).

You may also choose to share your item among combinations of the above, such as your entire organization and some specified groups, for example. See the Share a portal item topic for more information.