|
1 | 1 | ---
|
2 | 2 | title: SharePoint Online tenant properties
|
3 | 3 | description: Manage and read tenant properties, which allow tenant administrators to add properties in the app catalog that can be read by various SharePoint Framework components.
|
4 |
| -ms.date: 02/02/2018 |
| 4 | +ms.date: 06/05/2020 |
5 | 5 | ms.prod: sharepoint
|
6 | 6 | localization_priority: Priority
|
7 | 7 | ---
|
8 | 8 |
|
9 | 9 | # SharePoint Online tenant properties
|
10 | 10 |
|
11 |
| -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](https://technet.microsoft.com/library/fp161372.aspx), which is a PowerShell module to manage your SharePoint Online subscription in Office 365. |
| 11 | +Tenant properties allow tenant administrators to add properties in the app catalog that can be read using the SharePoint REST API. |
12 | 12 |
|
13 |
| -Alternatively, the [Office 365 CLI](https://pnp.github.io/office365-cli?utm_source=msft_docs&utm_medium=page&utm_campaign=Use+SharePoint+Online+tenant+properties) 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. |
| 13 | +## Options for working with tenant properties |
14 | 14 |
|
15 |
| -Yet another alternative for managing tenant properties is [PnP PowerShell](https://aka.ms/sppnp-powershell). The advantage of PnP PowerShell is that it does not 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 as well as [site collection app catalogs](../general-development/site-collection-app-catalog.md). |
| 15 | +The tenant properties are managed by tenant administrators by using one of the following options: |
16 | 16 |
|
17 |
| -## Use Microsoft SharePoint Online Management Shell commands to get, set and remove tenant properties |
| 17 | +### SharePoint REST API |
18 | 18 |
|
19 |
| -Using the [Microsoft SharePoint Online Management Shell](https://www.microsoft.com/download/details.aspx?id=35588), tenant administrators can use PowerShell to add and remove tenant properties. |
| 19 | +Learn more here: [SharePoint REST API](../sp-add-ins/get-to-know-the-sharepoint-rest-service.md) |
20 | 20 |
|
21 |
| -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. |
| 21 | +### Microsoft SharePoint Online Management Shell |
22 | 22 |
|
23 |
| -Before running the following script, connect to your SharePoint Online tenant using the `Connect-SPOService` cmdlet when using the SharePoint Online PowerShell. |
| 23 | +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. |
24 | 24 |
|
25 |
| -### Get-SPOStorageEntity |
| 25 | +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. |
26 | 26 |
|
27 |
| -- **Applies to** Office 365, SharePoint Online |
| 27 | +Learn more here: [Microsoft SharePoint Online Management Shell](https://technet.microsoft.com/library/fp161372.aspx) |
28 | 28 |
|
29 |
| -- **Syntax** Get-SPOStorageEntity [-Site] <AppCatalogSiteURL> [-Key] <String> |
| 29 | +### PnP PowerShell |
30 | 30 |
|
31 |
| -### Set-SPOStorageEntity |
| 31 | +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](../general-development/site-collection-app-catalog.md). |
32 | 32 |
|
33 |
| -- **Applies to** Office 365, SharePoint Online |
| 33 | +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. |
34 | 34 |
|
35 |
| -- **Syntax** Set-SPOStorageEntity [-Site] <AppCatalogSiteURL> [-Key] <String> [-Value] <String> [-Description] <String> [-Comments] <String> |
| 35 | +Learn more here: [PnP PowerShell](https://aka.ms/sppnp-powershell) |
36 | 36 |
|
37 |
| -### Remove-SPOStorageEntity |
| 37 | +> [!IMPORTANT] |
| 38 | +> 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. |
38 | 39 |
|
39 |
| -- **Applies to** Office 365, SharePoint Online |
| 40 | +[!INCLUDE [pnp-powershell](../../includes/snippets/open-source/pnp-powershell.md)] |
40 | 41 |
|
41 |
| -- **Syntax** Remove-SPOStorageEntity [-Site] <AppCatalogSiteURL> [-Key] <String> |
| 42 | +### Office 365 CLI |
42 | 43 |
|
43 |
| -## Use Office 365 CLI commands to get, set, remove and list tenant properties cross-platform |
| 44 | +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. |
44 | 45 |
|
45 |
| -Using the [Office 365 CLI](https://pnp.github.io/office365-cli?utm_source=msft_docs&utm_medium=page&utm_campaign=Use+SharePoint+Online+tenant+properties), tenant administrators can use shell commands to manage tenant properties. |
| 46 | +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. |
46 | 47 |
|
47 |
| -Before using the commands, connect to a SharePoint Online site, using the `spo connect` command. |
| 48 | +Learn more here: [Office 365 CLI](https://pnp.github.io/office365-cli?utm_source=msft_docs&utm_medium=page&utm_campaign=Use+SharePoint+Online+tenant+properties) |
48 | 49 |
|
49 |
| -### Get details for the specified tenant property |
| 50 | +> [!IMPORTANT] |
| 51 | +> 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. |
| 52 | +> |
| 53 | +> 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. |
50 | 54 |
|
51 |
| -The [spo storageentity get](https://pnp.github.io/office365-cli/cmd/spo/storageentity/storageentity-get/?utm_source=msft_docs&utm_medium=page&utm_campaign=Use+SharePoint+Online+tenant+properties) command can be used to get details for Office 365, SharePoint Online tenant property |
| 55 | +[!INCLUDE [pnp-o365cli](../../includes/snippets/open-source/pnp-o365cli.md)] |
52 | 56 |
|
53 |
| -```shell |
54 |
| -spo storageentity get --key <key> |
55 |
| -``` |
| 57 | +## List tenant properties |
56 | 58 |
|
57 |
| -### List tenant properties stored on the specified SharePoint Online app catalog |
| 59 | +The following options demonstrate how to list tenant properties from SharePoint Online. |
58 | 60 |
|
59 |
| -The [spo storageentity list](https://pnp.github.io/office365-cli/cmd/spo/storageentity/storageentity-list/?utm_source=msft_docs&utm_medium=page&utm_campaign=Use+SharePoint+Online+tenant+properties) command can be used to list all the tenant properties. |
| 61 | +# [SharePoint REST API](#tab/sprest) |
60 | 62 |
|
61 |
| -```shell |
62 |
| -spo storageentity list --appCatalogUrl <appCatalogUrl> |
| 63 | +### Request |
| 64 | + |
| 65 | +```http |
| 66 | +GET https://tenant.sharepoint.com/sites/site/_api/web/AllProperties?$select=storageentitiesindex |
63 | 67 | ```
|
64 | 68 |
|
65 |
| -### Set tenant property on a specified SharePoint Online app catalog |
| 69 | +### Response |
66 | 70 |
|
67 |
| -The [spo storageentity set](https://pnp.github.io/office365-cli/cmd/spo/storageentity/storageentity-set/?utm_source=msft_docs&utm_medium=page&utm_campaign=Use+SharePoint+Online+tenant+properties) command can be used to set tenant property |
| 71 | +```text |
| 72 | +HTTP/1.1 200 OK |
| 73 | +Content-Type: application/json |
| 74 | +{ |
| 75 | + "key": { |
| 76 | + "Comment":"Tenant property comment.", |
| 77 | + "Description":"Tenant property description", |
| 78 | + "Value":"Tenant property key value" |
| 79 | + } |
| 80 | +} |
| 81 | +``` |
68 | 82 |
|
69 |
| -```shell |
70 |
| -spo storageentity set --appCatalogUrl <appCatalogUrl> --key <key> --value <value> |
| 83 | +# [Microsoft SPO Management Shell](#tab/msposh) |
| 84 | + |
| 85 | +*Not supported* |
| 86 | + |
| 87 | +# [PnP PowerShell](#tab/pnpposh) |
| 88 | + |
| 89 | +```powershell |
| 90 | +Get-PnPStorageEntity |
71 | 91 | ```
|
72 | 92 |
|
73 |
| -### Remove tenant property stored on the specified SharePoint Online app catalog |
| 93 | +> Refer to the [PnP PowerShell documentation](/powershell/module/sharepoint-pnp/get-pnpstorageentity) for details on this cmdlet. |
74 | 94 |
|
75 |
| -The [spo storageentity remove](https://pnp.github.io/office365-cli/cmd/spo/storageentity/storageentity-remove/?utm_source=msft_docs&utm_medium=page&utm_campaign=Use+SharePoint+Online+tenant+properties) command can be used to remove tenant property |
| 95 | +# [Office 365 CLI](#tab/o365cli) |
76 | 96 |
|
77 | 97 | ```shell
|
78 |
| -spo storageentity remove --appCatalogUrl <appCatalogUrl> --key <key> |
| 98 | +spo storageentity list |
79 | 99 | ```
|
80 | 100 |
|
81 |
| -### Remarks when using the Office 365 CLI set and remove commands |
| 101 | +> Refer to the [Office 365 CLI documentation](https://pnp.github.io/office365-cli/cmd/spo/storageentity/storageentity-get/?utm_source=msft_docs&utm_medium=page&utm_campaign=Use+SharePoint+Online+tenant+properties) for details on this command. |
82 | 102 |
|
83 |
| -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. |
| 103 | +--- |
84 | 104 |
|
85 |
| -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. |
| 105 | +## Get/read tenant properties |
86 | 106 |
|
| 107 | +The following options demonstrate how to get tenant properties from SharePoint Online. |
87 | 108 |
|
88 |
| -## Use PnP PowerShell cmdlets to get, set, remove and list tenant properties |
| 109 | +# [SharePoint REST API](#tab/sprest) |
89 | 110 |
|
90 |
| -Using [PnP PowerShell](https://aka.ms/sppnp-powershell), site owners and site collection administrators can use PowerShell cmdlets to manage tenant properties. |
| 111 | +### Request |
91 | 112 |
|
92 |
| -Before using the cmdlets, connect to a SharePoint Online site, using the `Connect-PnPOnline` cmdlet. |
| 113 | +```http |
| 114 | +GET https://tenant.sharepoint.com/sites/site/_api/web/GetStorageEntity('key') |
| 115 | +``` |
93 | 116 |
|
94 |
| -### Get details for the specified tenant property |
| 117 | +### Response |
| 118 | + |
| 119 | +```text |
| 120 | +HTTP/1.1 200 OK |
| 121 | +Content-Type: application/json |
| 122 | +{ |
| 123 | + "Comment":"Tenant property comment.", |
| 124 | + "Description":"Tenant property description", |
| 125 | + "Value":"Tenant property key value" |
| 126 | +} |
| 127 | +``` |
95 | 128 |
|
96 |
| -The [Get-PnPStorageEntity](/powershell/module/sharepoint-pnp/get-pnpstorageentity) cmdlet can be used to get details for a SharePoint Online tenant property |
| 129 | +# [Microsoft SPO Management Shell](#tab/msposh) |
97 | 130 |
|
98 |
| -Get property from tenant app catalog: |
99 | 131 | ```powershell
|
100 |
| -Get-PnPStorageEntity -Key <key> |
| 132 | +Get-SPOStorageEntity -Site <AppCatalogSiteURL> -Key <String> |
101 | 133 | ```
|
102 | 134 |
|
103 |
| -Get property from a site collection app catalog: |
| 135 | +> Refer to the [Microsoft SPO Management Shell](/powershell/module/sharepoint-online/get-spostorageentity) for details on this cmdlet. |
| 136 | +
|
| 137 | +# [PnP PowerShell](#tab/pnpposh) |
| 138 | + |
104 | 139 | ```powershell
|
105 |
| -Get-PnPStorageEntity -Key <key> -Scope Site |
| 140 | +Get-PnPStorageEntity -Key <key> |
106 | 141 | ```
|
107 | 142 |
|
108 |
| -### List tenant properties stored on a SharePoint Online app catalog |
| 143 | +> Refer to the [PnP PowerShell documentation](/powershell/module/sharepoint-pnp/get-pnpstorageentity) for details on this cmdlet. |
109 | 144 |
|
110 |
| -The [Get-PnPStorageEntity](/powershell/module/sharepoint-pnp/get-pnpstorageentity) cmdlet can be used to list all the tenant properties. |
| 145 | +# [Office 365 CLI](#tab/o365cli) |
111 | 146 |
|
112 |
| -List properties of tenant app catalog: |
113 |
| -```powershell |
114 |
| -Get-PnPStorageEntity |
| 147 | +```shell |
| 148 | +spo storageentity get --key <key> |
115 | 149 | ```
|
116 |
| -List properties of site collection app catalog: |
| 150 | + |
| 151 | +> Refer to the [Office 365 CLI documentation](https://pnp.github.io/office365-cli/cmd/spo/storageentity/storageentity-get/?utm_source=msft_docs&utm_medium=page&utm_campaign=Use+SharePoint+Online+tenant+properties) for details on this command. |
| 152 | +
|
| 153 | +--- |
| 154 | + |
| 155 | +## Set/write tenant properties |
| 156 | + |
| 157 | +The following options demonstrate how to write tenant properties from SharePoint Online. |
| 158 | + |
| 159 | +# [SharePoint REST API](#tab/sprest) |
| 160 | + |
| 161 | +*Not supported* |
| 162 | + |
| 163 | +# [Microsoft SPO Management Shell](#tab/msposh) |
| 164 | + |
117 | 165 | ```powershell
|
118 |
| -Get-PnPStorageEntity -Scope Site |
| 166 | +Set-SPOStorageEntity -Site <AppCatalogSiteURL> -Key <String> -Value <String> -Description <string> -Comments <String> |
119 | 167 | ```
|
120 | 168 |
|
121 |
| -### Set tenant property on a SharePoint Online app catalog |
| 169 | +> Refer to the [Microsoft SPO Management Shell](/powershell/module/sharepoint-online/set-spostorageentity) for details on this cmdlet. |
122 | 170 |
|
123 |
| -The [Set-PnPStorageEntity](/powershell/module/sharepoint-pnp/set-pnpstorageentity) cmdlet can be used to set a tenant property. |
| 171 | +# [PnP PowerShell](#tab/pnpposh) |
124 | 172 |
|
125 |
| -Set property for tenant app catalog: |
126 | 173 | ```powershell
|
127 | 174 | Set-PnPStorageEntity -Key <key> -Value <value>
|
128 | 175 | ```
|
129 |
| -Set property for site collection app catalog: |
130 |
| -```powershell |
131 |
| -Set-PnPStorageEntity -Key <key> -Value <value> -Scope Site |
132 |
| -``` |
133 | 176 |
|
134 |
| -### Remove tenant property stored on a SharePoint Online app catalog |
| 177 | +> Refer to the [PnP PowerShell documentation](/powershell/module/sharepoint-pnp/set-pnpstorageentity) for details on this cmdlet. |
135 | 178 |
|
136 |
| -The [Remove-PnPStorageEntity](/powershell/module/sharepoint-pnp/remove-pnpstorageentity) cmdlet can be used to remove a tenant property. |
| 179 | +# [Office 365 CLI](#tab/o365cli) |
137 | 180 |
|
138 |
| -Remove property from tenant app catalog: |
139 |
| -```powershell |
140 |
| -Remove-PnPStorageEntity -Key <key> |
141 |
| -``` |
142 |
| -Remove property from site collection app catalog: |
143 |
| -```powershell |
144 |
| -Remove-PnPStorageEntity -Key <key> -Scope Site |
| 181 | +```shell |
| 182 | +spo storageentity set --key <key> --value <value> |
145 | 183 | ```
|
146 | 184 |
|
147 |
| -### Remarks when using the PnP PowerShell cmdlets |
| 185 | +> Refer to the [Office 365 CLI documentation](https://pnp.github.io/office365-cli/cmd/spo/storageentity/storageentity-set/?utm_source=msft_docs&utm_medium=page&utm_campaign=Use+SharePoint+Online+tenant+properties) for details on this command. |
148 | 186 |
|
149 |
| -You can connect to any site using the `Connect-PnPOnline` cmdlet, eg. Connect-PnPOnline https://contoso.sharepoint.com/sites/marketing. 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. |
| 187 | +--- |
150 | 188 |
|
151 |
| -## Read tenant properties |
| 189 | +## Remove tenant properties |
152 | 190 |
|
153 |
| -Developers can read tenant properties by using the SharePoint REST APIs and use them in SharePoint Framework components such as web parts and extensions. |
| 191 | +The following options demonstrate how to remove tenant properties from SharePoint Online. |
154 | 192 |
|
155 |
| -## HTTP request |
| 193 | +# [SharePoint REST API](#tab/sprest) |
156 | 194 |
|
157 |
| -### Get a tenant property |
| 195 | +*Not supported* |
158 | 196 |
|
159 |
| -```text |
160 |
| -GET _api/web/GetStorageEntity('key') |
| 197 | +# [Microsoft SPO Management Shell](#tab/msposh) |
| 198 | + |
| 199 | +```powershell |
| 200 | +Remove-SPOStorageEntity -Site <AppCatalogSiteURL> -Key <String> |
161 | 201 | ```
|
162 | 202 |
|
163 |
| -#### Example |
| 203 | +> Refer to the [Microsoft SPO Management Shell](/powershell/module/sharepoint-online/remove-spostorageentity) for details on this cmdlet. |
164 | 204 |
|
165 |
| -```text |
166 |
| -GET _api/web/GetStorageEntity('AnalyticsKey') |
| 205 | +# [PnP PowerShell](#tab/pnpposh) |
| 206 | + |
| 207 | +```powershell |
| 208 | +Remove-PnPStorageEntity -Key <key> |
167 | 209 | ```
|
168 | 210 |
|
169 |
| -#### Request body |
| 211 | +> Refer to the [PnP PowerShell documentation](/powershell/module/sharepoint-pnp/remove-pnpstorageentity) for details on this cmdlet. |
170 | 212 |
|
171 |
| -Do not supply a request body for this method. |
| 213 | +# [Office 365 CLI](#tab/o365cli) |
172 | 214 |
|
173 |
| -#### Response |
| 215 | +```shell |
| 216 | +spo storageentity remove --key <key> |
| 217 | +``` |
174 | 218 |
|
175 |
| -This returns the storage entity information for the given key. |
| 219 | +> Refer to the [Office 365 CLI documentation](https://pnp.github.io/office365-cli/cmd/spo/storageentity/storageentity-remove/?utm_source=msft_docs&utm_medium=page&utm_campaign=Use+SharePoint+Online+tenant+properties) for details on this command. |
176 | 220 |
|
177 |
| -```text |
178 |
| -HTTP/1.1 200 OK |
179 |
| -Content-Type: application/json |
180 |
| -{ |
181 |
| - "Comment":"Tenant property comment.", |
182 |
| - "Description":"Tenant property description", |
183 |
| - "Value":"Tenant property key value" |
184 |
| -} |
185 |
| -``` |
| 221 | +--- |
186 | 222 |
|
187 | 223 | ## Custom script and site collection app catalogs
|
188 | 224 |
|
189 |
| -It is 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: |
| 225 | +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: |
190 | 226 |
|
191 |
| -> Access denied. You do not have permission to perform this action or access this resource. |
| 227 | +`Access denied. You do not have permission to perform this action or access this resource.` |
192 | 228 |
|
193 | 229 | You can learn more about custom scripts here: [Allow or prevent custom script](/sharepoint/allow-or-prevent-custom-script).
|
194 | 230 |
|
195 |
| -Note that above error message will also be shown if you are not owner or site collection administrator of the site. |
| 231 | +The error message will also be shown if you aren't owner or site collection administrator of the site. |
196 | 232 |
|
197 | 233 | ## See also
|
198 | 234 |
|
199 | 235 | - [Overview of the SharePoint Framework](sharepoint-framework-overview.md)
|
| 236 | +- [Microsoft SharePoint Online Management Shell](https://technet.microsoft.com/library/fp161372.aspx) |
| 237 | +- [PnP PowerShell](https://aka.ms/sppnp-powershell) |
200 | 238 | - [Office 365 CLI](https://pnp.github.io/office365-cli?utm_source=msft_docs&utm_medium=page&utm_campaign=Use+SharePoint+Online+tenant+properties)
|
0 commit comments