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.

1 Answer 1


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;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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