Monday, May 19, 2008

Checking User rights at web and list level

Hi All,

There is a way how we can check if user is having specific rights on web as well as on list or not.

Here is a way how we can accomplish this task.

if (objWeb.DoesUserHavePermissions(SPBasePermissions.ViewFormPages) ||
//Code implementation

Here, for example we check on web level, assuming objWeb is your web object. Rest permissions can also be checked by checking different SPBasePermissions base.

Same way we can also check for SPList object.

Here is the sample for it.

//Code implementation

we are checking permissions on Tasks List, that can be replaced by any list name that you want to check.

No comments:

Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!

If anyone would like to have their advertisement posted on this blog, please send us the requirement details to