Export (0) Print
Expand All
Expand Minimize

SPList.EffectiveBasePermissions property

Gets the effective base permissions of the current user for the list, including their group membership and policies.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public override SPBasePermissions EffectiveBasePermissions { get; }

Property value

Type: Microsoft.SharePoint.SPBasePermissions
A bitwise combination of enumeration values that specifies the effective permissions that the current user has on the list.

Implements

ISecurableObject.EffectiveBasePermissions

The following example is a console application that checks whether the current user has SPBasePermissions.ApproveItems permission on the Shared Documents list in a Web site.

using System;
using Microsoft.SharePoint;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            using (SPSite site = new SPSite("http://localhost"))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    // Get a list to check permissions on.
                    string listUrl = web.RootFolder.ServerRelativeUrl + "shared documents";
                    SPList list = web.GetList(listUrl);

                    // Get the current user's rights mask for the list.
                    SPBasePermissions permMask = list.EffectiveBasePermissions;

                    // Check for a specific permission.
                    bool hasPermission = (permMask & SPBasePermissions.ApproveItems) != 0;
                    Console.WriteLine(hasPermission);
                }
            }
            Console.Write("\nPress ENTER to continue...");
            Console.ReadLine();
        }
    }
}

Show:
© 2014 Microsoft