I have a Flow that will update the permissions on an item based on the item's status. These items have a set of fields that contain names of users (people picker fields). In order to set the permissions on the item, I want to make an HTTP call to SharePoint. Do I need to use the user's ID, or can I do it with their email address or claims value?
1 Answer
You need the user's ID as it exists in the SharePoint site collection user list.
You can get these user properties with a SharePoint HTTP request that has the user's email in the Uri:
_api/web/SiteUsers/GetByEmail('[email protected]')
Then you can pull the ID from the results, like
body('SPHTTPGetUser')['d']['Id']
Finally, use that to set the permissions.
_api/web/lists/getbytitle('LibraryName')/items(ItemID)/roleassignments/addroleassignment(principalid=varUserID,roledefid=1073741827)