SharePoint Office 365 – How to Get the Lists with Unique Permission – CSOM PowerShell

Sathish Nadarajan
Solution Architect
March 13, 2018
Rate this article
[Total: 0    Average: 0/5]

In this earlier article, We saw how to get the lists having unique permission using C#. In the same manner, let us see, how to get the unique permission lists using PowerShell.

The script is straight forward and does not require much explanation.


 #Import the required client dlls
 Import-Module   'C:\SATHISH\PRACTICE SOURCE CODES\Office365.Console\packages\Microsoft.SharePointOnline.CSOM.16.1.6420.1200\lib\net45\Microsoft.SharePoint.Client.dll'
 Import-Module   'C:\SATHISH\PRACTICE SOURCE CODES\Office365.Console\packages\Microsoft.SharePointOnline.CSOM.16.1.6420.1200\lib\net45\Microsoft.SharePoint.Client.Runtime.dll'
 #Generic method to load the properties
 Function Invoke-LoadMethod() {
    [Microsoft.SharePoint.Client.ClientObject]$Object = $(throw "Please provide a Client Object"),
    $ctx = $Object.Context
    $load = [Microsoft.SharePoint.Client.ClientContext].GetMethod("Load") 
    $type = $Object.GetType()
    $clientLoad = $load.MakeGenericMethod($type) 
    $Parameter = [System.Linq.Expressions.Expression]::Parameter(($type), $type.Name)
    $Expression = [System.Linq.Expressions.Expression]::Lambda(
    $ExpressionArray = [System.Array]::CreateInstance($Expression.GetType(), 1)
    $ExpressionArray.SetValue($Expression, 0)
 #Mysite URL
 $site = ''
 #Admin User Principal Name
 $admin = 'sathish@sppalsmvp.OnMicrosoft.Com'
 #Get Password as secure String
 $password = Read-Host 'Enter Password' -AsSecureString
 #Get the Client Context and Bind the Site Collection
 $context = New-Object Microsoft.SharePoint.Client.ClientContext($site)
 $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($admin , $password)
 $context.Credentials = $credentials
 $list = $context.Web.Lists.GetByTitle('D1')
 Invoke-LoadMethod -Object $list -PropertyName "HasUniqueRoleAssignments"
 Write-Host $list.HasUniqueRoleAssignments 


Happy Coding,

Sathish Nadarajan.

Author Info

Sathish Nadarajan
Solution Architect
Rate this article
[Total: 0    Average: 0/5]
Sathish is a Microsoft MVP for SharePoint (Office Servers and Services) having 13+ years of experience in Microsoft Technologies. He holds a Masters Degree in Computer Aided Design and Business more

Leave a comment