SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want add file and folder in tree view control for specific user if he has permission to access that file and folder. I want to get permission of file or folder to check current user can access that file or folder in share point client object model.

share|improve this question

To check permissions to a list or library:

list.DoesUserHavePermissions(user, SPBasePermissions.AddListItems);

To check a list item its the same

item.DoesUserHavePermissions(user, SPBasePermissions.AddListItems)

To check a folder you do the check in the list item object of the folder:

folder.Item.DoesUserHavePermissions(user, SPBasePermissions.AddListItems)

Replace .AddListItems with .Open if you just want to check if they have read rights.

If you want to get the current user before elevating you code and iterating through content then the command is:

SPUser user = SPContext.Current.Web.CurrentUser;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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