Access Request Settings in SharePoint Online
The access request feature in SharePoint Online allows people to request access to the content they do not have permission to access. It also allows members of the site to send invitations to users who have no permission. Once the invitations are sent, the Site owner should approve them from Site settings >> Access requests and invitations. If you change these settings on the Site Collection level, then new subsites don’t inherit.
To configure access request email settings in SharePoint Online, Go to:
Similarly, on group-connected sites, You can set the access requests by going to Settings >> Site Permissions >> Click on “Change how members can share” >> Turn on the “Allow Access requests” and configure who will receive access requests for the site.
Please note, SharePoint Online access request email Site Settings must be configured at each site level. Let’s see SharePoint Online PowerShell to set access request email.
If a site is inhering permissions from its parent site, Access request settings also inherited! In other words, you can set access request settings for sites with unique permissions only!
Use this PowerShell script to update the SharePoint Online access request email.
#Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" #Set Variables for Site URL $SiteURL= "https://crescent.sharepoint.com/sites/sales/" $AccessReqEmail="SharePointSupport@crescent.com" #Setup Credentials to connect $Cred = Get-Credential $Cred = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password) Try < #Setup the context $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL) $Ctx.Credentials = $Cred #Get the current settings $Web = $Ctx.Web $Ctx.Load($web.AllProperties) $web.RequestAccessEmail $Ctx.ExecuteQuery() #sharepoint online powershell set access request email $Web.RequestAccessEmail =$AccessReqEmail #Member settings $Web.MembersCanShare = $True $web.AssociatedMemberGroup.AllowMembersEditMembership = $True $web.AssociatedMemberGroup.Update() $Web.Update() $Ctx.ExecuteQuery() >CatchThis sets SharePoint Online access request settings with PowerShell.
To disable the access request, simply clear the Email value!
#Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" #Set Variables for Site URL $SiteURL= "https://crescent.sharepoint.com/sites/sales/" #Setup Credentials to connect $Cred = Get-Credential $Cred = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password) Try < #Setup the context $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL) $Ctx.Credentials = $Cred #sharepoint online disable access request powershell $Web = $Ctx.Web $Web.RequestAccessEmail = [string]::Empty $Web.MembersCanShare = $False $web.AssociatedMemberGroup.AllowMembersEditMembership = $False $web.AssociatedMemberGroup.Update() $Web.Update() $Ctx.ExecuteQuery() >CatchTo change access request Emails of all sites in a site collection or tenant use: SharePoint Online: PowerShell to Change Access Request Email for All Sites
#Set Variables $SiteURL = "https://crescent.sharepoint.com/sites/Marketing" #Connect to PnP Online Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential) #Get the Web $Web = Get-PnPWeb #sharepoint online powershell disable access requests $Web.RequestAccessEmail = [string]::Empty $Web.SetUseAccessRequestDefaultAndUpdate($False) $Web.Update() $Web.Context.ExecuteQuery()
This PowerShell script clears both the Access Request Email and Group Settings! Similarly, to disable access requests for all sites in the tenant, use: SharePoint Online: Disable Access Requests for All Sites using PowerShell
To set access requests to the site owners, use:
#Set Variables $SiteURL = "https://crescent.sharepoint.com/sites/Marketing" #Connect to PnP Online Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential) #Get the Web $Web = Get-PnPWeb #Enable Access Request for the site to the Owners Group $Web.SetUseAccessRequestDefaultAndUpdate($True) $Web.Update() $Web.Context.ExecuteQuery()
Similarly, to set Emails in the access request, use the PnP PowerShell cmdlet Set-PnPRequestAccessEmails:
Connect-PnPOnline -Url https://crescent.sharepoint.com/sites/marketing -Interactive #Update Access Request Email Set-PnPRequestAccessEmails -Emails @("Admin@crescent.com", "SPAdmin@crescent.com")
To change the access request email in SharePoint Online, use the following:
#Enable Access Request for the site to a Email ID $Web.RequestAccessEmail = "Someone@YourDomain.com" $Web.SetUseAccessRequestDefaultAndUpdate($False) $Web.Update() $Web.Context.ExecuteQuery()
Last but not least: Are access requests and invitations missing in SharePoint Online? Well, that’s because – Access request settings are disabled!