Skip to content

Conversation

@milanholemans
Copy link
Contributor

Closes #7049

Copilot AI review requested due to automatic review settings November 26, 2025 00:07
Copilot finished reviewing on behalf of milanholemans November 26, 2025 00:09
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enforces delegated access tokens for OneNote commands by migrating three commands (onenote page list, onenote notebook list, onenote notebook add) from GraphCommand to GraphDelegatedCommand. This ensures these commands can only be used with delegated (user) permissions and not with application-only permissions.

Key Changes

  • Changed base class from GraphCommand to GraphDelegatedCommand for three OneNote commands
  • Refactored group ID retrieval to use the optimized entraGroup.getGroupIdByDisplayName() utility method
  • Added proper encoding for userName parameters using formatting.encodeQueryParameter()
  • Added $select=id query parameter optimization to minimize data transfer in API calls
  • Added comprehensive test coverage for delegated permission enforcement
  • Updated documentation to explicitly state that application permissions are not supported

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/m365/onenote/commands/page/page-list.ts Changed to extend GraphDelegatedCommand, added userName encoding, refactored to use entraGroup.getGroupIdByDisplayName()
src/m365/onenote/commands/page/page-list.spec.ts Added accessToken stub setup, new test for delegated permission enforcement, updated test URLs for encoding
src/m365/onenote/commands/notebook/notebook-list.ts Changed to extend GraphDelegatedCommand, added userName encoding, added $select=id optimization
src/m365/onenote/commands/notebook/notebook-list.spec.ts Added accessToken stub setup, new test for delegated permission enforcement, updated test URLs
src/m365/onenote/commands/notebook/notebook-add.ts Changed to extend GraphDelegatedCommand, added userName encoding
src/m365/onenote/commands/notebook/notebook-add.spec.ts Added accessToken stub setup, new test for delegated permission enforcement, updated test URLs
docs/docs/cmd/onenote/page/page-list.mdx Added Permissions section documenting delegated-only support, improved Remarks wording
docs/docs/cmd/onenote/notebook/notebook-list.mdx Added Permissions section documenting delegated-only support
docs/docs/cmd/onenote/notebook/notebook-add.mdx Added Permissions section documenting delegated-only support

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.

OneNote commands do not support application permissions anymore

1 participant