Skip to content

Enabling Quick Launch in batch with setting chrome options causes Access is denied#1789

Merged
Adam-it merged 2 commits into
pnp:devfrom
SherpasGroup:fix-set-chrome-options
Jul 4, 2026
Merged

Enabling Quick Launch in batch with setting chrome options causes Access is denied#1789
Adam-it merged 2 commits into
pnp:devfrom
SherpasGroup:fix-set-chrome-options

Conversation

@patrikhellgren

Copy link
Copy Markdown
Contributor

It appears that Microsoft has changed the API behavior related to Chrome options and Quick Launch configuration. We recently started experiencing an Access Denied error when applying a site template with Invoke-PnPSiteTemplate.
The issue was traced to the header provisioning step:

<pnp:Header Layout="Standard" />

Further debugging showed that the error originates from the SetChromeOptionsAsync implementation, where SetChromeOptions, SaveMenuState and QuickLaunchEnabled are executed within the same batch request.
As a workaround, separating the QuickLaunchEnabled call from the batch and executing it afterward resolves the issue. This suggests there may have been a change in the API's handling of batched requests involving Quick Launch settings.

@patrikhellgren patrikhellgren changed the title Do not batch enabling quick launch with setting chrome options Enabling Quick Launch in batch with setting chrome options causes Access is denied Jun 29, 2026
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.22%. Comparing base (63545f3) to head (d1c3d4a).
⚠️ Report is 3004 commits behind head on dev.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1789      +/-   ##
==========================================
- Coverage   82.42%   81.22%   -1.21%     
==========================================
  Files         416      637     +221     
  Lines       28590    45416   +16826     
  Branches        0     4781    +4781     
==========================================
+ Hits        23565    36887   +13322     
- Misses       5025     7118    +2093     
- Partials        0     1411    +1411     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Adam-it Adam-it left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patrikhellgren Awesome work, and thank you for contributing this fix.
I myself bumped into this issue when testing some provisioning PRs from PnP Framework repo, and was going to fix it when I noticed that you had already done so. Community Rocks 🤩
✅ Checked locally
🔧Cosmetic fixup needed - will do myself

Comment on lines 566 to 574
if (chromeOptions.Navigation != null)
{
// Update the navigation visibility
await (context.Web as Web).RawRequestBatchAsync(batch, BuildQuickLaunchEnabledApiCall(chromeOptions), new HttpMethod("PATCH"), "Update").ConfigureAwait(false);

// Update the footer displayName
if (chromeOptions.Footer != null)
{
await BuildAndAddSaveMenuStateRequestAsync(chromeOptions.Footer as FooterOptions, null, batch).ConfigureAwait(false);
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only have a minor comment that we may combine those two if the conditions how to a single one

@Adam-it Adam-it merged commit 88f714c into pnp:dev Jul 4, 2026
3 checks passed
Adam-it pushed a commit that referenced this pull request Jul 4, 2026
 #1791 (#1789)

It appears that Microsoft has changed the API behavior related to Chrome
options and Quick Launch configuration. We recently started experiencing
an Access Denied error when applying a site template with
Invoke-PnPSiteTemplate.
The issue was traced to the header provisioning step:
``` xml
<pnp:Header Layout="Standard" />
```
Further debugging showed that the error originates from the
SetChromeOptionsAsync implementation, where SetChromeOptions,
SaveMenuState and QuickLaunchEnabled are executed within the same batch
request.
As a workaround, separating the QuickLaunchEnabled call from the batch
and executing it afterward resolves the issue. This suggests there may
have been a change in the API's handling of batched requests involving
Quick Launch settings.
Adam-it added a commit that referenced this pull request Jul 4, 2026
@patrikhellgren patrikhellgren deleted the fix-set-chrome-options branch July 5, 2026 00:57
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.

SetChromeOptionsAsync fails on Microsoft 365 group-connected sites with app-only auth

3 participants