Usage
m365 spo list roleassignment add [options]
Description
adds a role assignment to list permissions
Options
| Option |
Description |
-u, --webUrl <webUrl> |
URL of the site where the list is located |
-i, --listId [listId] |
ID of the list. Specify either listId, listTitle or listUrl but not multiple. |
-t, --listTitle [listTitle] |
Title of the list. Specify either listId, listTitle or listUrl but not multiple. |
--listUrl [listUrl] |
Relative URL of the list. Specify either listId, listTitle or listUrl but not multiple. |
--principalId [principalId] |
SharePoint ID of principal it may be either user id or group id we want to add permissions to. Specify principalId only when upn or groupName are not used. |
--upn [upn] |
upn/email of user to assign role to. Specify either upn or princpialId |
--groupName [groupName] |
enter group name of Azure AD or SharePoint group.. Specify either groupName or princpialId |
--roleDefinitionId [roleDefinitionId] |
ID of role definition. Specify either roleDefinitionId or roleDefinitionName but not both |
--roleDefinitionName [roleDefinitionName] |
enter the name of a role definition, like 'Contribute', 'Read', etc. Specify either roleDefinitionId or roleDefinitionName but not both |
Additional Info
this command was actually my goal since I added this #3184 idea 🙂 so I am really excited we are getting close 🤩.
since we are able to break/reset permissions on list, items (some done some open PR's) (files/folders need aliasing to be added... need to open a issue for that 😉) and we are able to list roledefinitions (add/get/remove are open issues) and since we already have commands which allow us to get user or group id, the last and final step is to use all this in order to add or remove user or group with specific roledefinition on list or item (lets start with list 😉).
for this we may use this POST endpoint
/_api/web/lists/getbytitle("SomeList")/roleassignments/addroleassignment(principalid='{SomeGroupOrUserIDHere}',roledefid='{SomeRoleIdHere}')
Usage
m365 spo list roleassignment add [options]
Description
adds a role assignment to list permissions
Options
-u, --webUrl <webUrl>-i, --listId [listId]-t, --listTitle [listTitle]--listUrl [listUrl]--principalId [principalId]--upn [upn]--groupName [groupName]--roleDefinitionId [roleDefinitionId]--roleDefinitionName [roleDefinitionName]Additional Info
this command was actually my goal since I added this #3184 idea 🙂 so I am really excited we are getting close 🤩.
since we are able to break/reset permissions on list, items (some done some open PR's) (files/folders need aliasing to be added... need to open a issue for that 😉) and we are able to list roledefinitions (add/get/remove are open issues) and since we already have commands which allow us to get user or group id, the last and final step is to use all this in order to add or remove user or group with specific roledefinition on list or item (lets start with list 😉).
for this we may use this POST endpoint
/_api/web/lists/getbytitle("SomeList")/roleassignments/addroleassignment(principalid='{SomeGroupOrUserIDHere}',roledefid='{SomeRoleIdHere}')