SharePoint Online tenant properties

Tenant properties allow tenant administrators to add properties in the app catalog that can be read by various SharePoint Framework components. The tenant properties are managed by tenant administrators by using the Microsoft SharePoint Online Management Shell, which is a PowerShell module to manage your SharePoint Online subscription in Office 365.

Alternatively, 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.

Manage tenant properties

Using the Microsoft SharePoint Online Management Shell, tenant administrators can use PowerShell to add and remove tenant properties.

The following PowerShell cmdlets are available to manage the tenant properties. Because tenant properties are stored in the tenant app catalog, you must provide the tenant app catalog site collection URL in the following cmdlets.

Before running the following script, connect to your SharePoint Online tenant using the Connect-SPOService cmdlet when using the SharePoint Online PowerShell.

Get-SPOStorageEntity

  • Applies to Office 365, SharePoint Online

  • Syntax Get-SPOStorageEntity [-Site] [-Key]

Set-SPOStorageEntity

  • Applies to Office 365, SharePoint Online

  • Syntax Set-SPOStorageEntity [-Site] [-Key] [-Value] [-Description] [-Comments]

Remove-SPOStorageEntity

  • Applies to Office 365, SharePoint Online

  • Syntax Remove-SPOStorageEntity [-Site] [-Key]

Office 365 CLI commands to get, set, remove and list tenant properties cross-platform

Using the Office 365 CLI, tenant administrators can use shell commands to manage tenant properties.

Before using the commands, connect to a SharePoint Online site, using the spo connect command.

Get details for the specified tenant property

The spo storageentity get command can be used to get details for Office 365, SharePoint Online tenant property

spo storageentity get --key <key>

List tenant properties stored on the specified SharePoint Online app catalog

The spo storageentity list command can be used to list all the tenant properties.

spo storageentity list --appCatalogUrl <appCatalogUrl>

Set tenant property on a specified SharePoint Online app catalog

The spo storageentity set command can be used to set tenant property

spo storageentity set --appCatalogUrl <appCatalogUrl> --key <key> --value <value>

Remove tenant property stored on the specified SharePoint Online app catalog

The spo storageentity remove command can be used to remove tenant property

spo storageentity remove --appCatalogUrl <appCatalogUrl> --key <key>

Remarks when using the Office 365 CLI set and remove commands

To set or remove a tenant property, you have to first connect to a tenant admin site using the spo connect command, eg. spo connect https://contoso-admin.sharepoint.com. 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.

Read tenant properties

Developers can read tenant properties by using the SharePoint REST APIs and use them in SharePoint Framework components such as web parts and extensions.

HTTP request

Get a tenant property

GET _api/web/GetStorageEntity('key')

Example

GET _api/web/GetStorageEntity('AnalyticsKey')

Request body

Do not supply a request body for this method.

Response

This returns the storage entity information for the given key.

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

See also