How to set up Access Requests in SharePoint online using Powershell?
Hello SharePointers, Below are the powershell commands to set up the access requests in SharePoint Online.
$URL= "https://laks.sharepoint.com/sites/happy/"
$AccessRequest="SharePointadmin@mycompany.com"
$Cred = Get-Credential
$Cred = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($URL)
$Ctx.Credentials = $Cred
$Web = $Ctx.Web
$Ctx.Load($web.AllProperties)
$web.RequestAccessEmail
$Ctx.ExecuteQuery()
#Set Access request Email
$Web.RequestAccessEmail =$AccessRequest
#Member settings
$Web.MembersCanShare = $True
$web.AssociatedMemberGroup.AllowMembersEditMembership = $True
$web.AssociatedMemberGroup.Update()
$Web.Update()
$Ctx.ExecuteQuery()
Happy SharePointing Folks 🙂