-
Notifications
You must be signed in to change notification settings - Fork 366
Description
Usage
m365 spo site accessrequest setting set [options]
Description
Update access requests for a specific site
Options
| Option | Description |
|---|---|
-u, --siteUrl <siteUrl> |
URL of the site collection. |
--disabled |
Disable site requests for the entire site. Specify either disabled, ownerGroup, or email. |
--ownerGroup |
Send access requests to the owner group. Specify either disabled, ownerGroup, or email. |
--email [email] |
Send access requests to a specific email. Specify either disabled, ownerGroup, or email. |
--message [message] |
Add a custom message to the access request page. |
Examples
Disable access requests for a specific site.
m365 spo site accessrequest setting set --siteUrl https://contoso.sharepoint.com/sites/Management --disabledSend all access requests to the owner group of a specific site.
m365 spo site accessrequest setting set --siteUrl https://contoso.sharepoint.com/sites/Management --ownerGroupSend all access requests to a specific email address and set a custom message.
m365 spo site accessrequest setting set --siteUrl https://contoso.sharepoint.com/sites/Management --email [email protected] --message "Motivate why you need access."Default properties
N/A
Additional Info
The original idea was created here: #6266
I named this command spo site accessrequest setting set to make it future-proof. In this case, we can still create commands to list all access requests from people on a site, and other commands do approve/decline them.
Let's also make sure we can pass an empty string for message option to clear it.
API
To manage this, there are 3 API requests needed:
Request 1:
PATCH https://contoso.sharepoint.com/sites/Playground/_api/Web
{
"RequestAccessEmail": "[email protected]"
}Request 2:
POST https://contoso.sharepoint.com/sites/Playground/_api/Web/SetUseAccessRequestDefaultAndUpdate
{
"useAccessRequestDefault": false
}Request 3:
POST https://contoso.sharepoint.com/sites/Playground/_api/Web/SetAccessRequestSiteDescriptionAndUpdate
{
"description": "Hey you want access? That's $77."
}When updating access requests, consider the following:
| Option used | Request 1 value | Request 2 value |
|---|---|---|
--disabled |
"" (empty) |
false |
--ownerGroup |
"" (empty) |
true |
--email [email protected] |
[email protected] |
false |
Request 3 should only be used when --message is specified (this isn't possible when using --disabled).