spo listitem roleassignment add
Adds a role assignment to a listitem.
Usage
m365 spo listitem roleassignment add [options]
Options
-u, --webUrl <webUrl>
URL of the site where the list item is located
--listId [listId]
ID of the list. Specify either
listId
,listTitle
orlistUrl
but not multiple.--listTitle [listTitle]
Title of the list. Specify either
listId
,listTitle
orlistUrl
but not multiple.--listUrl [listUrl]
Relative URL of the list. Specify either
listId
,listTitle
orlistUrl
but not multiple.--listItemId <listItemId>
Id of the list item to assign the role to.
--principalId [principalId]
The SharePoint Id of the principal. It may be either a user id or group id to add a role assignment for. Specify either
upn
,groupName
orprincipalId
.--upn [upn]
The upn/email of user to assign role to. Specify either
upn
,groupName
orprincipalId
.--groupName [groupName]
The group name of the SharePoint group Specify either
upn
,groupName
orprincipalId
.--roleDefinitionId [roleDefinitionId]
ID of role definition. Specify either
roleDefinitionId
orroleDefinitionName
but not both.--roleDefinitionName [roleDefinitionName]
The name of a role definition, like 'Contribute', 'Read', etc. Specify either
roleDefinitionId
orroleDefinitionName
but not both.
-h, --help [help]
Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are
options
,examples
,remarks
,response
,full
. Default isoptions
.--query [query]
JMESPath query string. See http://jmespath.org/ for more information and examples.
-o, --output [output]
Output type.
json
,text
,csv
,md
,none
. Defaultjson
.--verbose
Runs command with verbose logging.
--debug
Runs command with debug logging.
Examples
Add role assignment to specified list item in specified list located in specified site for specified principal id and specified role definition id.
m365 spo listitem roleassignment add --webUrl "https://contoso.sharepoint.com/sites/project-x" --listTitle "someList" --listItemId 1 --principalId 11 --roleDefinitionId 1073741829
Add role assignment to specified list item in specified list located in specified site for specified principal id and specified role definition id.
m365 spo listitem roleassignment add --webUrl "https://contoso.sharepoint.com/sites/project-x" --listId "0CD891EF-AFCE-4E55-B836-FCE03286CCCF" --listItemId 1 --principalId 11 --roleDefinitionId 1073741829
Add role assignment to specified list item in specified list located in specified site for specified principal id and specified role definition id.
m365 spo listitem roleassignment add --webUrl "https://contoso.sharepoint.com/sites/project-x" --listUrl "sites/documents" --listItemId 1 --principalId 11 --roleDefinitionId 1073741829
Add role assignment to specified list item in specified list located in specified site for specified upn and specified role definition id.
m365 spo listitem roleassignment add --webUrl "https://contoso.sharepoint.com/sites/project-x" --listTitle "someList" --listItemId 1 --upn "someaccount@tenant.onmicrosoft.com" --roleDefinitionId 1073741829
Add role assignment to specified list item in specified list located in specified site for specified group and specified role definition id.
m365 spo listitem roleassignment add --webUrl "https://contoso.sharepoint.com/sites/project-x" --listTitle "someList" --listItemId 1 --groupName "someGroup" --roleDefinitionId 1073741829
Add role assignment to specified list item in specified list located in specified site for specified principal id and specified role definition name.
m365 spo listitem roleassignment add --webUrl "https://contoso.sharepoint.com/sites/project-x" --listTitle "someList" --listItemId 1 --principalId 11 --roleDefinitionName "Full Control"
Response
The command won't return a response on success.