Open louderthanloud123 opened 3 weeks ago
I suggest that we split this into 2 commands:
Let's keep this one for the sharing permissions.
I suggest the following:
m365 spo site sharing set [options]
Control how things in a site can be shared.
Option | Description |
---|---|
-u, --siteUrl <siteUrl> |
URL of the site collection. |
--capability <capability> |
Define how the site is shared. Possible values: full , limited , ownersOnly . |
Update the sharing capability for a site where only owners can share files and the site
m365 spo site sharing 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 sharing set --siteUrl https://siteaddress.com/sites/sitename --capability full
N/A
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.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 |
@pnp/cli-for-microsoft-365-maintainers what do you think of the spec? It's about this setting in SharePoint:
Good catch on splitting this into two commands. The specs look very clear to me!
Good catch on splitting this into two commands. The specs look very clear to me!
Ok, opening it up then.
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
Update the sharing capability for a site where only both owners and members can share files and the site
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
Update member group
When updating the sharing status of a site, the API requests above should be used with the values below:
full
true
true
limited
true
false
ownersOnly
false
false