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)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
Public Overrides ReadOnly Property EffectiveBasePermissions As SPBasePermissions
    Get
'Usage
Dim instance As SPList
Dim value As SPBasePermissions

value = instance.EffectiveBasePermissions
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

Examples

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.

Imports System
Imports Microsoft.SharePoint

Module Test

    Sub Main()
        Using site As SPSite = New SPSite("https://localhost")
            Using web As SPWeb = site.OpenWeb()

                ' Get a list to check permissions on.
                Dim listUrl As String = web.RootFolder.ServerRelativeUrl + "shared documents"
                Dim list As SPList = web.GetList(listUrl)

                ' Get the current user's rights mask for the list.
                Dim permMask As SPBasePermissions = list.EffectiveBasePermissions

                ' Check for a specific permission.
                Dim hasPermission As Boolean = (permMask & SPBasePermissions.ApproveItems) <> 0
                Console.WriteLine(hasPermission)

            End Using
        End Using
        Console.Write(vbCrLf + "Press ENTER to continue...")
        Console.ReadLine()
    End Sub

End Module
using System;
using Microsoft.SharePoint;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            using (SPSite site = new SPSite("https://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();
        }
    }
}

See Also

Reference

SPList Class

SPList Members

Microsoft.SharePoint Namespace