Skip to content
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

Fix Access Denied error when processing <pnp:SiteSettings> object #360

Merged
merged 1 commit into from
Jun 7, 2021

Conversation

jackpoz
Copy link
Contributor

@jackpoz jackpoz commented Jun 1, 2021

This PR fixes an Access Denied error when processing pnp:SiteSettings object caused by ExecuteQuery() calls triggered by helper methods (like site.IsCommunicationSite()) executed on the wrong Context object.

By manually calling ExecuteQuery() right away, we ensure the updated settings are sent using the correct Context object. As many of the helper methods like site.IsCommunicationSite() already trigger ExecuteQuery() calls, it kind of makes the whole isDirty pattern useless as it gives the false impression that only 1 call at the end will be made as a single point where the updated settings are sent, while in fact it can happen before too.

This issue fixes #357 , see the long troubleshooting at #357 (comment)

jansenbe added a commit that referenced this pull request Jun 7, 2021
@jansenbe jansenbe merged commit a6eda21 into pnp:dev Jun 7, 2021
@jansenbe jansenbe self-assigned this Jun 7, 2021
@jackpoz jackpoz deleted the fixes/access-denied-settings branch December 4, 2022 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invoke-PnPSiteTemplate throws Access denied error on SiteSettings
2 participants