2

I am working with Document Library with CSOM C# with SharePoint 2010.

I need to remove the users assigned to the Folder in Document Library. I am able to find the codes via PowerShell, SharePoint Object Model but I am unable to find help on CSOM.

BreakRoleInheritance() already done. Also I am able to get all users using following code.

List siteUserInfoList = clientContext.Web.SiteUserInfoList;
                CamlQuery query = new CamlQuery();
                query.ViewXml = "";
                IEnumerable<ListItem> itemColl = clientContext.LoadQuery(siteUserInfoList.GetItems(query));
                clientContext.ExecuteQuery();
                foreach (var item in itemColl)
                {
                    Console.WriteLine("ID:{0}  Email:{1} Title:{2}", item.Id, item["EMail"], item["Title"]);
                }

Now I Just want to remove the user from folder. Is there any method using which we can remove the user from Folder in Document Library?

1

Once you have the user login you can do as below

folderListItem.get_roleAssignments().getByPrincipal(spuserobject).deleteObject();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.