0

With SharePoint Online, are there any ways to find if a list/document library has item(s) with unique permissions using PowerShell without iterating through all the items in it.

When a list/library has item(s) with unique permission, the permission page - List(Library) Settings -> Permissions for this list (document library) - shows a message "Some items of this list may have unique permissions which are not controlled from this page."

I am wondering how the page is getting this information - I checked the definition of SPList (https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.list_properties.aspx) but there do not seem to have a relevant property for this.

I have a PowerShell script with CSOM to collect various information associated with lists. If iterating through all the items in a list and check their permission, it would slow the script down considerably especially when a list contains a large number of items.

1

This is possible in PowerShell or SharePoint Server Object Model by using SPList method GetItemsWithUniquePermissions https://msdn.microsoft.com/en-us/library/ee572463.aspx

Examples:-

PowerShell

$web = Get-SPWeb("http://site_url")
$list = $web.Lists["list_title"]
$itemCount = $list.GetItemsWithUniquePermissions().Count

SharePoint Server Object Model

using(SPSite site = new SPSite("http://site_url"))
{
    using(SPWeb web = site.OpenWeb())
    {
        SPList list = web.Lists["list_title"];
        int itemCount = list.GetItemsWithUniquePermissions().Count;
    }
}
  • Is the method available with SharePoint Online? I cannot find it in the documentation - msdn.microsoft.com/en-us/library/… – Jumpei Yamauchi Sep 2 '17 at 4:53
  • Sorry @JumpeiYamauchi, GetItemsWithUniquePermissions is available only on on-premises SharePoint server object model . Microsoft must be using server object model to display the message "Some items of this list may have unique permissions which are not controlled from this page." – Ahmad Zia Sep 3 '17 at 23:32

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.