pnp/cli-microsoft365

New command: `spo site accessrequest list`

Open

#6,304 opened on Sep 3, 2024

View on GitHub
 (6 comments) (1 reaction) (1 assignee)TypeScript (399 forks)auto 404
good first issueneeds researchnew featurework in progress

Repository metrics

Stars
 (1,390 stars)
PR merge metrics
 (PR metrics pending)

Description

Usage

m365 spo site accessrequest list [options]

Description

Lists all access requests for a specific site.

Options

Option Description
-u, --siteUrl <siteUrl> URL of the site collection.
--state [state] Only show access requests with a specific state. Valid values are: approved, declined, pending. All requests are returned by default.

Examples

List all access requests of a specific site

m365 spo site accessrequest list --siteUrl https://contoso.sharepoint.com/sites/Marketing

List all pending access requests of a specific site

m365 spo site accessrequest list --siteUrl https://contoso.sharepoint.com/sites/Marketing --state pending

Default properties

Unsure what useful data we can return here.

Additional Info

Result modifications

Since it's totally not clear in the result what state an access request is in, let's modify the result by adding an extra field statusLabel that contains a value pending, approved, declined.

There are a bunch of fields that are not retrieved by default but contain useful information (e.g. RequestedForDisplayName). Let's see which fields are useful to include in the result.

API

Seems like we can use:

GET https://contoso.sharepoint.com/sites/Marketing/_api/Web/AccessRequestsList/Items

It's quite unclear at the moment how approved, pending, and declined items look like.

My current assumptions (let's recheck this):

  • Approved: Status has value 1.
  • Pending: Status has value 0.
  • Declined: Status has value 3.

Example response

{
        "FileSystemObjectType": 0,
        "Id": 1,
        "ServerRedirectedEmbedUri": null,
        "ServerRedirectedEmbedUrl": "",
        "ContentTypeId": "0x002652494C69B1BA408247321FEC814128",
        "OData__ColorTag": null,
        "ComplianceAssetId": null,
        "ApprovedByStringId": "11",
        "PermissionLevelRequested": 5,
        "Conversation": null,
        "RequestDate": "2024-09-03T22:07:04Z",
        "PropagateAcl": false,
        "IsForAdditionalAccess": false,
        "ID": 1,
        "Modified": "2024-09-03T22:11:51Z",
        "Created": "2024-09-03T22:07:04Z",
        "AuthorId": 1073741823,
        "EditorId": 11,
        "OData__UIVersionString": "2.0",
        "Attachments": false,
        "GUID": "12916ed5-1bbb-4f03-b2bf-d2355f551024"
}

Contributor guide