Search code examples
c#sharepoint-2010rightsspgroup

user rights to add document in library SharePoint 2010


I want to check, if user can add document in document library then custom action is enabled. I used this article.

And then I encountered the following problem: I don't know how check user rights of adding for this library.

I try to use SPGroup of current web, but I need to know names of groups, and this names is not constant. I can get roles of current user, but how can get information about what this set of roles contain the role of type SPRoleType.Contributor?

I would be grateful for any attempt to help!


Solution

  • Yeah, I found solution!

    bool t = list.Permissions.DoesUserHavePermissions(SPRights.AddListItems) 
    

    Return true if user can add document to library!