Forum Discussion
Set SharePoint access requests to owner group
Currently, this information is not exposed with the REST/CSOM APIs, so it cannot be controlled by using remote options (SPO or PnP PowerShell or code). We are looking into exposing this API with the CSOM in future, but there's no ETA for that work.
We also need to change the "Access Request" method to set to Owner Group as it is possible through interface.
We are writing a CSOM method to create site from template and the "access request" option need to be set in the code using CSOM.
Please, tell me if any update of CSOM library is forecast or give any solution to update this option by code using any other library...
Regards.
- redddOct 18, 2019Copper Contributor
Hi,
I think this will help:
https://sharepoint.stackexchange.com/questions/239489/sharepoint-pnp-powershell-how-to-provision-sub-webs-with-unique-permissions-an
#Connect to Site Collection$me = Get-Credential Connect-PnPOnline -Url https://mytenet.sharepoint.com/sites/MySiteCollection -Credentials $me #Create sub web with unique permissions New-PnPWeb -Title "ProjectB Web" -Url ProjectB -Description "Information about ProjectB" -BreakInheritance -InheritNavigation -Template "STS#0" Connect-PnPOnline -Url "https://mytenet.sharepoint.com/sites/MySiteCollection/ProjectB" -Credentials $me $owner = (Get-PnPContext).Credentials.UserName #Create default groups for the new web #here, by default owner will be the person provisioning the groups$ownerGroup = New-PnPGroup -Title "ProjectB Web Owners" -Owner $ownerSet-PnPGroup -Identity $ownerGroup -SetAssociatedGroup Owners$memberGroup = New-PnPGroup -Title "ProjectB Web Members" -Owner $ownerSet-PnPGroup -Identity $memberGroup -SetAssociatedGroup Members$visitorGroup = New-PnPGroup -Title "ProjectB Web Visitors" -Owner $ownerSet-PnPGroup -Identity $visitorGroup -SetAssociatedGroup Visitors #Apply template with groups. Templates applies OK, but groups are not defined Apply-PnPProvisioningTemplate -Path C:\ProjectSiteTemplate.xml -Web projectB