SharePoint Online tenant properties

Tenant properties allow tenant administrators to add properties in the app catalog that can be read using the SharePoint REST API.

Options for working with tenant properties

The tenant properties are managed by tenant administrators by using one of the following options:

SharePoint REST API

Learn more here: SharePoint REST API

Microsoft SharePoint Online Management Shell

The tenant properties are managed by tenant administrators by using the Microsoft SharePoint Online Management Shell, a PowerShell module from Microsoft used to manage your SharePoint Online subscription in Office 365.

Before using any of the cmdlets in the Microsoft SharePoint Online Management Shell module, you must first connect to SharePoint Online using the Connect-SPOService cmdlet. All tenant properties are managed using the *-SPOStorageEntity cmdlets.

Learn more here: Microsoft SharePoint Online Management Shell

PnP PowerShell

The advantage of PnP PowerShell is that it doesn't require tenant administrator privileges to set those properties. Any member of the Owners group of an app catalog site can do this. This applies to the tenant app catalog site and site collection app catalogs.

Prior to using any of the cmdlets in the PnP PowerShell module, you must first connect to SharePoint Online using the Connect-PnPOnline cmdlet. All tenant properties are managed using the *-PnPStorageEntity cmdlets.

Learn more here: PnP PowerShell

Important

You can connect to any site using the Connect-PnPOnline cmdlet. When you omit the -Scope parameter or set it to Tenant, which is the default value, all cmdlets apply to the tenant app catalog regardless of the site you connected to. If you set the -Scope parameter to Site all cmdlets will apply to the site collection app catalog of the site you connected to.

Note

PnP PowerShell is an open-source solution with active community providing support for it. There is no SLA for the open-source tool support from Microsoft.

Office 365 CLI

The Office 365 CLI can be used to manage the tenant properties. The Office 365 CLI is a cross-platform command-line interface that can be used on any platform, including Windows, macOS, and Linux.

Before using any of the commands in the Office 365 CLI, you must first connect to SharePoint Online using the login command. All tenant properties are managed using the spo storageentity commands.

Learn more here: Office 365 CLI

Important

To set or remove a tenant property, you have to first connect to a tenant admin site using the spo connect command. If you are connected to a different site and will try to manage tenant properties, you will get an error.

Tenant properties are stored in the app catalog site associated with that tenant. To set or remove a property, you have to specify the absolute URL of the app catalog site. If you specify the URL of a site different than the app catalog, you will get an access denied error.

Note

The Office 365 CLI is an open-source solution with active community providing support for it. There is no SLA for the open-source tool support from Microsoft.

List tenant properties

The following options demonstrate how to list tenant properties from SharePoint Online.

Request

GET https://tenant.sharepoint.com/sites/site/_api/web/AllProperties?$select=storageentitiesindex

Response

HTTP/1.1 200 OK
Content-Type: application/json
{
  "key": {
    "Comment":"Tenant property comment.",
    "Description":"Tenant property description",
    "Value":"Tenant property key value"
  }
}

Get/read tenant properties

The following options demonstrate how to get tenant properties from SharePoint Online.

Request

GET https://tenant.sharepoint.com/sites/site/_api/web/GetStorageEntity('key')

Response

HTTP/1.1 200 OK
Content-Type: application/json
{
  "Comment":"Tenant property comment.",
  "Description":"Tenant property description",
  "Value":"Tenant property key value"
}

Set/write tenant properties

The following options demonstrate how to write tenant properties from SharePoint Online.

Not supported

Remove tenant properties

The following options demonstrate how to remove tenant properties from SharePoint Online.

Not supported

Custom script and site collection app catalogs

It's only allowed to set tenant properties on site collection app catalogs in sites that have custom scripts enabled. When you try to set a tenant property in a "no-script site", the following error will be shown:

Access denied. You do not have permission to perform this action or access this resource.

You can learn more about custom scripts here: Allow or prevent custom script.

The error message will also be shown if you aren't owner or site collection administrator of the site.

See also