You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/spfx/tenant-properties.md
+78-2Lines changed: 78 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,9 @@ Tenant properties allow tenant administrators to add properties in the app catal
12
12
13
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.
14
14
15
-
## Manage tenant properties
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).
16
+
17
+
## Use Microsoft SharePoint Online Management Shell commands to get, set and remove tenant properties
16
18
17
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.
18
20
@@ -38,7 +40,7 @@ Before running the following script, connect to your SharePoint Online tenant us
## Office 365 CLI commands to get, set, remove and list tenant properties cross-platform
43
+
## Use Office 365 CLI commands to get, set, remove and list tenant properties cross-platform
42
44
43
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.
44
46
@@ -82,6 +84,70 @@ To set or remove a tenant property, you have to first connect to a tenant admin
82
84
83
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.
84
86
87
+
88
+
## Use PnP PowerShell cmdlets to get, set, remove and list tenant properties
89
+
90
+
Using [PnP PowerShell](https://aka.ms/sppnp-powershell), site owners and site collection administrators can use PowerShell cmdlets to manage tenant properties.
91
+
92
+
Before using the cmdlets, connect to a SharePoint Online site, using the `Connect-PnPOnline` cmdlet.
93
+
94
+
### Get details for the specified tenant property
95
+
96
+
The [Get-PnPStorageEntity](/powershell/module/sharepoint-pnp/get-pnpstorageentity) cmdlet can be used to get details for a SharePoint Online tenant property
97
+
98
+
Get property from tenant app catalog:
99
+
```powershell
100
+
Get-PnPStorageEntity -Key <key>
101
+
```
102
+
103
+
Get property from a site collection app catalog:
104
+
```powershell
105
+
Get-PnPStorageEntity -Key <key> -Scope Site
106
+
```
107
+
108
+
### List tenant properties stored on a SharePoint Online app catalog
109
+
110
+
The [Get-PnPStorageEntity](/powershell/module/sharepoint-pnp/get-pnpstorageentity) cmdlet can be used to list all the tenant properties.
111
+
112
+
List properties of tenant app catalog:
113
+
```powershell
114
+
Get-PnPStorageEntity
115
+
```
116
+
List properties of site collection app catalog:
117
+
```powershell
118
+
Get-PnPStorageEntity -Scope Site
119
+
```
120
+
121
+
### Set tenant property on a SharePoint Online app catalog
122
+
123
+
The [Set-PnPStorageEntity](/powershell/module/sharepoint-pnp/set-pnpstorageentity) cmdlet can be used to set a tenant property.
124
+
125
+
Set property for tenant app catalog:
126
+
```powershell
127
+
Set-PnPStorageEntity -Key <key> -Value <value>
128
+
```
129
+
Set property for site collection app catalog:
130
+
```powershell
131
+
Set-PnPStorageEntity -Key <key> -Value <value> -Scope Site
132
+
```
133
+
134
+
### Remove tenant property stored on a SharePoint Online app catalog
135
+
136
+
The [Remove-PnPStorageEntity](/powershell/module/sharepoint-pnp/remove-pnpstorageentity) cmdlet can be used to remove a tenant property.
137
+
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
145
+
```
146
+
147
+
### Remarks when using the PnP PowerShell cmdlets
148
+
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.
150
+
85
151
## Read tenant properties
86
152
87
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.
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:
190
+
191
+
> Access denied. You do not have permission to perform this action or access this resource.
192
+
193
+
You can learn more about custom scripts here: [Allow or prevent custom script](/sharepoint/allow-or-prevent-custom-script).
194
+
195
+
Note that above error message will also be shown if you are not owner or site collection administrator of the site.
196
+
121
197
## See also
122
198
123
199
-[Overview of the SharePoint Framework](sharepoint-framework-overview.md)
0 commit comments