Adds command spo site accessrequest list#7218
Adds command spo site accessrequest list#7218MathijsVerbeeck wants to merge 1 commit intopnp:mainfrom
spo site accessrequest list#7218Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new SharePoint Online command to the CLI for Microsoft 365 to list site access requests, with accompanying tests and documentation, aligning SPO command capabilities with the requested feature in #6304.
Changes:
- Introduces
m365 spo site accessrequest listcommand implementation, including optional filtering by request state and adding a derivedStatusLabel. - Adds a comprehensive Mocha test suite for validation, filtering behavior, and error handling.
- Adds command documentation and registers it in the SPO commands list and docs sidebar.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/m365/spo/commands/site/site-accessrequest-list.ts | Implements the new SPO access request listing command with optional state filtering and StatusLabel projection. |
| src/m365/spo/commands/site/site-accessrequest-list.spec.ts | Adds unit tests covering validation, state filtering, empty results, and error handling. |
| src/m365/spo/commands.ts | Registers the new command name constant. |
| docs/src/config/sidebars.ts | Adds the new command page to the SPO site commands navigation. |
| docs/docs/cmd/spo/site/site-accessrequest-list.mdx | Adds the reference documentation page for the new command. |
| private static readonly statusMap: { [key: number]: string } = { | ||
| 0: 'pending', | ||
| 1: 'approved', | ||
| 3: 'declined' | ||
| }; |
There was a problem hiding this comment.
statusMap (Status -> label) and getStatusValue (label -> Status) duplicate the same mapping in two places, which can drift over time (eg if SharePoint adds/changes status codes). Consider defining a single source of truth (eg two maps derived from one definition, or a single map used for both directions) and reusing it for both labeling and filtering.
| <Global /> | ||
|
|
||
| ## Examples | ||
|
|
||
| List all access requests of a specific site. | ||
|
|
||
| ```sh | ||
| m365 spo site accessrequest list --siteUrl https://contoso.sharepoint.com/sites/Marketing | ||
| ``` | ||
|
|
||
| List all pending access requests of a specific site. | ||
|
|
||
| ```sh | ||
| m365 spo site accessrequest list --siteUrl https://contoso.sharepoint.com/sites/Marketing --state pending | ||
| ``` | ||
|
|
There was a problem hiding this comment.
The new command docs page is missing a Permissions section. Related SPO site commands (including spo site accessrequest setting set) document required SharePoint delegated/application permissions, and without this section users can’t easily determine what consent is needed to run the command.
Closes #6304