Replies: 2 comments
-
I tested this on another tenant and the same script works fine. The difference I'm aware of is that the root site of the not working tenant is a classic site (created pre 2019). The root site on the 2nd tenant is a modern communication. The site I'm connecting to ($site.url ) is not the root site, but it seems so related since Push Notifications is turned on in the SharePoint admin center. |
Beta Was this translation helpful? Give feedback.
-
updated the root site on my tenant to a modern communication site. The script in my automation account using -ManagedIdentity still has the same error: MethodInvocationException: Line | 80 | $Web.Context.ExecuteQuery() | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Exception calling "ExecuteQuery" with "0" argument(s): "The Push Notifications feature is not activated on the site 'https://tenantname.sharepoint.com/sites/sitename'" |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When I'm trying to submit changes to a specific SharePoint site I get the following error:
PS > $Web.Context.ExecuteQuery()
MethodInvocationException: Exception calling "ExecuteQuery" with "0" argument(s): "The Push Notifications feature is not activated on the site 'https://tenantname.sharepoint.com/sites/TestSharing2'"
This happens when I'm connected using the -Interactive OR when I'm running the script in my Automation Account with a system assigned managed identity (-ManagedIdentity).
When I'm connected using the -UseWebLogin parameter, I get no errors.
Anyone got any ideas?
code I'm using:
`
$c = Get-PnPConnection -ErrorAction SilentlyContinue
if ($c){
Disconnect-PnPOnline #close any open/broken connection
}
Connect-PnPOnline https://tenantname-admin.sharepoint.com -ManagedIdentity
$sites = Get-PnPTenantSite -ErrorAction Continue
Disconnect-PnPOnline
$sites = $sites | Where -Property Template -In ("GROUP#0", "SITEPAGEPUBLISHING#0","STS#3","TEAMCHANNEL#0","TEAMCHANNEL#1") | ? {$_.url -like "testsharing"}
write-output $sites
write-output $sites.count
foreach ($site in $Sites){
Connect-PnPOnline -Url $site.url -ManagedIdentity
write-output $site.url
$Web = Get-PnPWeb
#$Context = Get-PnPContext
#Update Sharing permissions setting
#Set third option - Only site owners can share files, folders, and the site.
$Web.MembersCanShare = $false
$Web.Update()
$Web.Context.ExecuteQuery()
Disconnect-PnPOnline
}
`
https://pnp.github.io/powershell/articles/azureautomationrunbook.html
https://morgantechspace.com/2022/06/manage-sharing-permissions-in-sharepoint-online-site-using-powershell.html
requires Azure AD SharePoint admin role to run Get-PnPTenantSite on the Managed Identity
requires Sites.FullControl.All (graph or SPO) for changing settings on sites on the Managed Identity
Beta Was this translation helpful? Give feedback.
All reactions