Usage
m365 spo listitem roleassignment add [options]
Description
adds a role assignment to a listitem.
Options
| Option |
Description |
-u, --webUrl <webUrl> |
URL of the site where the list is located |
--listId [listId] |
ID of the list. Specify either listId, listTitle or listUrl. |
--listTitle [listTitle] |
Title of the list. Specify either listId, listTitle or listUrl. |
--listUrl [listUrl] |
Relative URL of the list. Specify either listId, listTitle or listUrl. |
--listItemId <listItemId> |
Id of the listitem 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 or principalId. |
--upn [upn] |
upn/email of user to assign role to. Specify either upn, groupName or principalId. |
--groupName [groupName] |
The group name of Azure AD or SharePoint group. Specify either upn, groupName or principalId. |
--roleDefinitionId [roleDefinitionId] |
ID of role definition. Specify either roleDefinitionId or roleDefinitionName but not both |
--roleDefinitionName [roleDefinitionName] |
The name of a role definition, like 'Contribute', 'Read', etc. Specify either roleDefinitionId or roleDefinitionName but not both |
we may use this POST endpoint
/_api/web/lists/getbytitle("SomeList")/items("SomeId")/roleassignments/addroleassignment(principalid='{SomeGroupOrUserIDHere}',roledefid='{SomeRoleIdHere}')
Usage
m365 spo listitem roleassignment add [options]
Description
adds a role assignment to a listitem.
Options
-u, --webUrl <webUrl>--listId [listId]listId,listTitleorlistUrl.--listTitle [listTitle]listId,listTitleorlistUrl.--listUrl [listUrl]listId,listTitleorlistUrl.--listItemId <listItemId>--principalId [principalId]upn,groupNameorprincipalId.--upn [upn]upn,groupNameorprincipalId.--groupName [groupName]upn,groupNameorprincipalId.--roleDefinitionId [roleDefinitionId]roleDefinitionIdorroleDefinitionNamebut not both--roleDefinitionName [roleDefinitionName]roleDefinitionIdorroleDefinitionNamebut not bothwe may use this POST endpoint
/_api/web/lists/getbytitle("SomeList")/items("SomeId")/roleassignments/addroleassignment(principalid='{SomeGroupOrUserIDHere}',roledefid='{SomeRoleIdHere}')