-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug when setting "DenyAddAndCustomizePages" on the site properties. #1592
Comments
We had the same issue and switched back to CSOM for this, because there it is still working. Our production environment was affected and we needed a solution for this issue fast. What we also determined is, that even if the error occurred, the state has still been changed. Nevertheless this issue should be looked into and getting fixed. While PnP Core uses hand crafted CSOM requests for this, it looks like there is still a difference between the requests of the original library and PnP, which then triggers a different path on the server. |
We are also seeing the same issues when setting Site Collection properties. We set the StorageMaximumLevel and the value is not saved. |
Seems like it's just setting any site collection properties. I've tried StorageMaximumLevel, StorageWarningLevel, SharingCapability, DefaultSharingLinkType, and DefaultLinkToExistingAccess.. all produce this error. |
we have the same problem. @fzbm can you share your workaround ? |
@raclettierer we worked around the issue using PnP Framework using the interop. The Site Collection Properties property is similar, there's just some extra scaffolding needed to initiate an admin center context, load the properties, and then save them: //get the admin context from existing site context
var adminCenterContext = await pnpContext.GetSharePointAdmin().GetTenantAdminCenterContextAsync();
//create a PnP Framework CSOM context from the PnP Core context
using ClientContext csomContext = PnPCoreSdk.Instance.GetClientContext(adminCenterContext);
//get the site properties
var tenant = new Microsoft.Online.SharePoint.TenantAdministration.Tenant(csomContext);
var siteAdminProperties = tenant.GetSitePropertiesByUrl(siteUrl, true);
tenant.Context.Load(siteAdminProperties);
await tenant.Context.ExecuteQueryRetryAsync();
//update site properties
siteAdminProperties.SharingCapability = Microsoft.Online.SharePoint.TenantManagement.SharingCapabilities.Disabled;
siteAdminProperties.Update();
//execute the query (the "Update" method doesn't actually save the change in PnP Framework)
await tenant.Context.ExecuteQueryRetryAsync(); This obviously introduces some tech debt because the PnP Framework is pseudo-deprecated, but it works. |
We also have this issue, it was working in production the entirety of 2024 until around this issue was created. seriously frustrated. I am reluctant to use the work around because if this issue is fixed, a revert will need to be done. Thanks for sharing your code @LutzD-pkb |
Sorry, was not able to answer yesterday, but @LutzD-pkb already posted an example of how we did this. Instead of using the PnP Core method to get a |
Category
Describe the bug
When setting the "DenyAddAndCustomizePages" on site properties, it's throwing a PnP.Core.CsomServiceException with the message "The requested operation is part of an experimental feature that is not supported in the current environment.". The value is actually set in SharePoint but we shouldn't be getting an exception returned. Potentially is a Microsoft update that is making this occur.
Both settings cause an issue:
Steps to reproduce
When calling the 'Update' method it throws the exception PnP.Core.CsomServiceException
Expected behavior
No Exception is thrown when it successfully sets in SharePoint.
Environment details (development & target environment)
Additional context
Thanks for your contribution! Sharing is caring.
The text was updated successfully, but these errors were encountered: