How can I get the Document Libraries permissions in Sharepoint 2010?
-
24-10-2019 - |
Question
I'm developing a Webpart and I need to go through every document library and get its permissions. Basically I need to get the groups and its permissions associated with the document library.
I have iterated through the properties and methods of a SPDocumentLibrary
object but couldn't find anything really.
Any help or guide would be appreciated.
Thank you
Solution
I would first check HasUniqueRoleAssignments. If it is false, then the permissions for that document library are inherited from the website. If it is true, as Jason said, I would then check the Member and RoleDefinitionBindings of each SPRoleAssignment.
OTHER TIPS
Try SPDocomentLibrary.RoleAssignments. This will give you SPRoleAssignments where the Member property is a SPGroup or a SPUser.