cli-microsoft365
cli-microsoft365 copied to clipboard
New command: 🔐 spo file roleinheritance reset
Usage
m365 spo file roleinheritance reset [options]
Description
Restores the role inheritance of file
Options
Option | Description |
---|---|
-u, --webUrl <webUrl> |
URL of the site where the file for which to reset role inheritance is located |
--fileUrl [fileUrl] |
The server-relative URL of the file to retrieve. Specify either file url or file id but not both |
-i, --fileId [fileId] |
The UniqueId (GUID) of the file to retrieve. Specify either file url or file id but not both |
--confirm |
Don't prompt for confirmation |
Examples
Reset inheritance of file with id (UniqueId) b2307a39-e878-458b-bc90-03bc578531d6 located in site https://contoso.sharepoint.com/sites/project-x
m365 spo file roleinheritance reset --webUrl "https://contoso.sharepoint.com/sites/project-x" --fileId "b2307a39-e878-458b-bc90-03bc578531d6"
Reset inheritance of file with server-relative url /sites/project-x/documents/Test1.docx located in site https://contoso.sharepoint.com/sites/project-x
m365 spo file roleinheritance reset --webUrl "https://contoso.sharepoint.com/sites/project-x" --fileUrl "/sites/project-x/documents/Test1.docx"
Additional Info
I suggest we use Cli.executeCommandWithOutput
and in the command implementation reuse the m365 spo listitem roleinheritance reset
command which will also work in this case but we just need to pass the listItem Id. So the command should handle getting the correct file list item id by passed fileId
or fileUrl
and execute the listeItem roleinheritance reset
command 👍
@pnp/cli-for-microsoft-365-maintainers similar case for the reset
. Any comments on this one?
Looks great @Adam-it!
Could you add an extra example of how the list options are used? And some extra comment on how those options are only applicable when using fileId?
Let's update descriptions for fileId
and fileUrl
to be explicit which ID and URL we're referring to.
@waldekmastykarz I updated the spec @martinlingstuyl I actually made a mistake 😉. We don't need list information. File Unique Id or ServerRelativeUrl is enough to get the file
That's awesome @Adam-it!
Can I work on this?
Can I work on this?
Yes totally 👍. Thank you, you rock 🤩
@nanddeepn along the way we agreed internally that all roleinheritance reset/break
should have --confim
option and if not use should prompt the user to confirm this operation. Very similar to what we use in remove
commands.
I updated the spec. Please consider it as well during you development
Thanks @Adam-it