spo list roleassignment add
Adds a role assignment to list permissions
Usage
m365 spo list roleassignment add [options]
Options
-u, --webUrl <webUrl>URL of the site where the list is located.
-i, --listId [listId]ID of the list. Specify either
listId,listTitle, orlistUrlbut not multiple.-t, --listTitle [listTitle]Title of the list. Specify either
listId,listTitle, orlistUrlbut not multiple.--listUrl [listUrl]Relative URL of the list. Specify either
listId,listTitle, orlistUrlbut not multiple.--principalId [principalId]SharePoint ID of principal it may be either user id or group id we want to add permissions to. Specify either
principalId,upn, orgroupNamebut not multiple.--upn [upn]Upn/email of user to assign role to. Specify either
principalId,upn, orgroupNamebut not multiple.--groupName [groupName]Enter group name of Azure AD or SharePoint group. Specify either
principalId,upn, orgroupNamebut not multiple.--roleDefinitionId [roleDefinitionId]ID of role definition. Specify either
roleDefinitionIdorroleDefinitionNamebut not both.--roleDefinitionName [roleDefinitionName]Enter the name of a role definition, like 'Contribute', 'Read', etc. Specify either
roleDefinitionIdorroleDefinitionNamebut 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 isfull.--query [query]JMESPath query string. See http://jmespath.org/ for more information and examples.
-o, --output [output]Output type.
json,text,csv,md. Defaultjson.--verboseRuns command with verbose logging.
--debugRuns command with debug logging.
Examples
Adds role assignment to a list by title located in a specific site for given principal id and role definition id.
m365 spo list roleassignment add --webUrl "https://contoso.sharepoint.com/sites/project-x" --listTitle "someList" --principalId 11 --roleDefinitionId 1073741829
Adds role assignment to list by id located in a specific site for given principal id and role definition id.
m365 spo list roleassignment add --webUrl "https://contoso.sharepoint.com/sites/project-x" --listId "0CD891EF-AFCE-4E55-B836-FCE03286CCCF" --principalId 11 --roleDefinitionId 1073741829
Adds role assignment to list by url located in a specific site for given principal id and role definition id.
m365 spo list roleassignment add --webUrl "https://contoso.sharepoint.com/sites/project-x" --listUrl "sites/documents" --principalId 11 --roleDefinitionId 1073741829
Adds role assignment to list by title located in a specific site for given upn and role definition id.
m365 spo list roleassignment add --webUrl "https://contoso.sharepoint.com/sites/project-x" --listTitle "someList" --upn "someaccount@tenant.onmicrosoft.com" --roleDefinitionId 1073741829
Adds role assignment to list by title located in a specific site for given group and role definition id.
m365 spo list roleassignment add --webUrl "https://contoso.sharepoint.com/sites/project-x" --listTitle "someList" --groupName "someGroup" --roleDefinitionId 1073741829
Adds role assignment to list by title located in a specific site for given principal id and role definition name.
m365 spo list roleassignment add --webUrl "https://contoso.sharepoint.com/sites/project-x" --listTitle "someList" --principalId 11 --roleDefinitionName "Full Control"
Response
The command won't return a response on success.