Sharepoint site privacy settings though code

203 Views Asked by At

I have stressed all morning regarding this minor issue.

I have x sharepoint sites, some of them are public some of them are private. I want to be able to modify the privacy settings through code, but so far I have only been able to do it manually.

I can set the field if I create the site anew, but I have not managed to do it if the site already exists.

I have also looked into: https://learn.microsoft.com/en-us/powershell/module/sharepoint-pnp/?view=sharepoint-ps, but have not found a commandlet to update this.

[1]: https://i.stack.imgur.com/STxfz.png

1

There are 1 best solutions below

0
On

Answer: I finally managed to get this to work using the _api/SP.Directory.DirectorySession/Group(id) endpoint.

I could not find official documentation though, and had to do it by moniting the network traffic