Archive for April, 2012

Checking user permissions: DoesUserHavePermissions vs. CatchAccessDeniedException

Checking user permissions DoesUserHavePermissions vs CatchAccessDeniedException

I recently had a nice discussion with a colleague about the best way to check if the current user has permissions to view a specified SharePoint list in a SP2010 site using C#.

 

 

Basically there are 2 ways to check for permissions:

1) SPSecurableObject.DoesUserHavePermissions

2) SPSecurity.CatchAccessDeniedException

This post ┬ádiscusses both methods, proposes implementations and discusses the pro’s and cons.

(more…)