phpSPO icon indicating copy to clipboard operation
phpSPO copied to clipboard

how to add a user to a directory in sharepoint

Open selianto opened this issue 2 years ago • 0 comments

Hello,

I'd like to use phpSPO to create a directory in one of my teams sites, and then allow certain users to be able to edit it. I understand that I need to do two things (after creating the directory, which is straighforward):

  1. interrupt the role inheritance with something like this: $folderItem->breakRoleInheritance(true)->executeQuery();
  2. and then add the new roles for the users I want to add. I believe that to do so I need to use something like the method "setHasUniqueRoleAssignments" - but I'm not quite sure how, and how to add users (the ones I want to add) and mode (read or edit). How do I do this?

in future, I will also want to remove users as needed - how do I achieve this?

thanks in advance for your answers ciao Simone

selianto avatar Nov 29 '21 19:11 selianto