Is there a way I can set DenyAddAndCustomizePages using PnP?
I know it can be done using "SharePoint Online Management Shell" via the Set-SPOSite command. However, this command does not exist in PnP. Also I'd rather not have to load both modules. I'm trying to standardise on PnP.
The above works, but if I run it twice within about 30 seconds, changing the value, I get the following error:
Exception calling "ExecuteQuery" with "0" argument(s): "Cannot set properties on site https://<private>.sharepoint.com/
because the site is not currently available."
At line:26 char:1
+ CategoryInfo : NotSpecified: (:) , MethodInvocationException
+ FullyQualifiedErrorId : ServerException
This is becuase the previous update has not yet finished. I've tried putting a pause in using the following code (between the Update and ExecuteQuery), but it does not seem to get the updated value for the 'Status' field:
# Wait for site to become available
$status = $null
while ($status -ne 'Active')
Write-Host "Waiting... $status"
Start-Sleep -Seconds 5
$status = $site.Status