1

I need to check the currently logged in user having the create list permission or not.

suggest some idea .

3

Inside your web part / application pages, you could add some helper methods, like:

private bool CouldCurrentUserManageLists()
{
    SPUser user = SPContext.Current.Web.Url;
    using (SPSite site = new SPSite("http://yourspsiteurl"))
    {
        using (SPWeb web = site.OpenWeb())
        {
            return web.DoesUserHavePermissions(user.LoginName, SPBasePermissions.ManageLists));
        }
    }
    return false;
}
2

You can use DoesUserHavePermissions method to check user permission. below is the code snippet to use this method.

   if (web.DoesUserHavePermissions(SPBasePermissions.PermissionwhichYouWanttoCheck))
   {
       //Your Code
   }

Below are the permissions which can be checked web level Web level permission
Open
ViewPages
AddAndCustomizePages
ApplyThemeAndBorder
ApplyStyleSheets
ViewUsageData
CreateSSCSite
ManageSubwebs
CreateGroups
ManagePermissions
BrowseDirectories
BrowseUserInfo
AddDelPrivateWebParts
UpdatePersonalWebParts
ManageWeb UseRemoteAPIs
ManageAlerts
CreateAlerts
EditMyUserInfo

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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