Skip to content

Added minimal permissions for 'spo folder sharinglink' commands. Closes #7275#7449

Draft
SmitaNachan wants to merge 1 commit into
pnp:mainfrom
SmitaNachan:issue-7275
Draft

Added minimal permissions for 'spo folder sharinglink' commands. Closes #7275#7449
SmitaNachan wants to merge 1 commit into
pnp:mainfrom
SmitaNachan:issue-7275

Conversation

@SmitaNachan

Copy link
Copy Markdown
Contributor

Added minimal permissions for spo folder sharinglink commands. Closes #7275

@milanholemans

Copy link
Copy Markdown
Contributor

Thanks, we'll review it soon!

@Adam-it Adam-it self-assigned this Jul 15, 2026

@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.

@SmitaNachan awesome work so far but there are a few things that were missed.
May I kindly ask you to give it an another go before we make this a perfect merge 💪
You Rock 🤩

Comment on lines +50 to +59
| Resource | Permissions |
|------------|-----------------|
| SharePoint | Files.ReadWrite |

</TabItem>
<TabItem value="Application">

| Resource | Permissions |
|------------|---------------------|
| SharePoint | Files.ReadWrite.All |

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.

shouldn't this be a Microsoft Graph resource here, as we are refering this those permissions scopes?
https://learn.microsoft.com/en-us/graph/api/driveitem-createlink?view=graph-rest-1.0&tabs=http


<Global />

## Permissions

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.

The problem is that the folder sharinglink add command also uses spo.getFolderServerRelativeUrl util in it's logic

const relFolderUrl: string = await spo.getFolderServerRelativeUrl(args.options.webUrl, args.options.folderUrl, args.options.folderId, logger, args.options.verbose);

which uses a SharePoint Rest API call, we should also the minimal scope required also to perform this.

Comment on lines +41 to +50
| Resource | Permissions |
|------------|-----------------|
| SharePoint | Files.ReadWrite |

</TabItem>
<TabItem value="Application">

| Resource | Permissions |
|------------|---------------------|
| SharePoint | Files.ReadWrite.All |

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.

Also here I think we are referring to Microsoft Graph permission scopes.
Also here the command logic also uses spo.getFolderServerRelativeUrl which uses the SharePoint Rest API for which we will need minimal permission scopes as well


| Resource | Permissions |
|------------|---------------------|
| SharePoint | Files.ReadWrite.All |

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.

Also here we should refer to Microsoft Graph permission scopes
Also the ReadWrite scope seems to extreme for a GET type command. I would expect Read scope would be enough, could we recheck this?
Also this command uses spo.getFolderServerRelativeUrl so it means we will need a minimal scope for this as well

Comment on lines +36 to +49
<TabItem value="Delegated">

| Resource | Permissions |
|------------|-----------------|
| SharePoint | Files.ReadWrite |

</TabItem>
<TabItem value="Application">

| Resource | Permissions |
|------------|---------------------|
| SharePoint | Files.ReadWrite.All |

</TabItem>

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.

Same comment as for the get command.
We should refer to Microsoft Graph scopes. It seems ReadWrite scopes are to big for a LIST command type, I would expect Read is enough https://learn.microsoft.com/en-us/graph/api/driveitem-list-permissions?view=graph-rest-1.0&tabs=http

Also it uses the spo.getFolderServerRelativeUrl method which uses SP Rest API. We need to document minimal permissions also for this one

Comment on lines +39 to +51
<TabItem value="Delegated">

| Resource | Permissions |
|------------|-----------------|
| SharePoint | Files.ReadWrite |

</TabItem>
<TabItem value="Application">

| Resource | Permissions |
|------------|---------------------|
| SharePoint | Files.ReadWrite.All |

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.

Also here, we should refer to Microsoft Graph scopes, and we need to document minial permissions for spo.getFolderServerRelativeUrl method which is SP REST API based method

Comment on lines +39 to +52
<TabItem value="Delegated">

| Resource | Permissions |
|------------|-----------------|
| SharePoint | Files.ReadWrite |

</TabItem>
<TabItem value="Application">

| Resource | Permissions |
|------------|---------------------|
| SharePoint | Files.ReadWrite.All |

</TabItem>

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.

And here as well:

  • let's rename to Microsoft Graph resource
  • let's add minimal scopes for spo.getFolderServerRelativeUrl method

@Adam-it
Adam-it marked this pull request as draft July 19, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Minimal permissions for 'spo folder sharinglink' commands

3 participants