I have a sharepoint list like that:
List
---------Folder 1
-----------------Item 1
-----------------Item 2
---------Folder 2
-----------------Item 1
-----------------Item 2
---------Folder 3
-----------------Item 1
-----------------Item 2
How can I get all Folders in
List?After that checking if current user has
Contributepermission onFolder 1,Folder 2,Folder 3?
To get the list of folders of a list you can use the
Foldersproperty of theSPListobject:To check if a given user has Contribute permission on a folder you need to get the
SPListItemassociated with theSPFolder,check for aRoleAssignmentof the given user and check itsRoleDefinitionBindingsfor the Contribute Role Definition:Usage example