Usage
m365 spo site sharingpermission set [options]
Description
Control how a site and its components can be shared.
Options
| Option |
Description |
-u, --siteUrl <siteUrl> |
URL of the site collection. |
--capability <capability> |
Define how the site is shared. Possible values: full, limited, ownersOnly. |
Examples
Update the sharing capability for a site where only owners can share files and the site
m365 spo site sharingpermission set --siteUrl https://siteaddress.com/sites/sitename --capability ownersOnly
Update the sharing capability for a site where only both owners and members can share files and the site
m365 spo site sharingpermission set --siteUrl https://siteaddress.com/sites/sitename --capability full
Default properties
N/A
Additional Info
Docs remarks
When specifying capability, consider the following:
full: Site owners and members can share files, folders, and the site. People with Edit permissions can share files and folders.
limited: Site owners and members, and people with Edit permissions can share files and folders, but only site owners can share the site.
ownersOnly: Only site owners can share files, folders, and the site.
API request
To update this setting, we have to execute 2 requests.
Update web
PATCH https://contoso.sharepoint.com/sites/Playground/_api/Web
{
"MembersCanShare": true
}
Update member group
PATCH https://contoso.sharepoint.com/sites/Playground/_api/Web/AssociatedMembergroup
{
"AllowMembersEditMembership": true
}
When updating the sharing status of a site, the API requests above should be used with the values below:
| Sharing status |
Update web value |
Update member group value |
full |
true |
true |
limited |
true |
false |
ownersOnly |
false |
false |
Usage
m365 spo site sharingpermission set [options]
Description
Control how a site and its components can be shared.
Options
-u, --siteUrl <siteUrl>--capability <capability>full,limited,ownersOnly.Examples
Update the sharing capability for a site where only owners can share files and the site
m365 spo site sharingpermission set --siteUrl https://siteaddress.com/sites/sitename --capability ownersOnlyUpdate the sharing capability for a site where only both owners and members can share files and the site
m365 spo site sharingpermission set --siteUrl https://siteaddress.com/sites/sitename --capability fullDefault properties
N/A
Additional Info
Docs remarks
When specifying
capability, consider the following:full: Site owners and members can share files, folders, and the site. People with Edit permissions can share files and folders.limited: Site owners and members, and people with Edit permissions can share files and folders, but only site owners can share the site.ownersOnly: Only site owners can share files, folders, and the site.API request
To update this setting, we have to execute 2 requests.
Update web
Update member group
When updating the sharing status of a site, the API requests above should be used with the values below:
fulltruetruelimitedtruefalseownersOnlyfalsefalse