0

I have a document library that is well over 5,000 items. I need to update the document library permissions, but I'm unable to do that, whenever I try and break inheritence it gives me the warning

'The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator.'

I have also tried via the CSOM.

Surely Microsoft hasn't made it impossible to change permission once a doc library is over 5,000 files?

1
  • 1
    Of all the operations limited by the list view threshold, changing permissions on a document library is not one that I've seen documented. Are there many documents within the library that have unique permissions?
    – Thriggle
    Jul 11, 2019 at 16:00

6 Answers 6

1

The work around I have used to bypass this is to delete some of the items in order to get below the 5000 item limit, then do the changes to the list and then restore the deleted items. Crude but it works

4
  • not possible. this doc library has well over 100,000 files.
    – Michael
    Jan 29, 2019 at 23:04
  • Not a problem with Powershell as your friend Jan 30, 2019 at 5:21
  • Powerhsell using CSOM same as C# code, so i dont think this will help.
    – Michael
    Jan 30, 2019 at 13:39
  • It does, the trick is to get fewer than 5000 items, then you will be able to modify the library Jan 30, 2019 at 16:09
0

Your suspicions are correct. Microsoft severely limits what you can do with that document library. If you can't temporarily move documents out, I would recommend creating a new library with the desired permissions, and migrate the documents to that one. While you're at it, you can add indexed metadata to fix the 5,000 limit permanently.

1
  • Unfortunately its not that easy . Ive tried splitting up libraries. the "Move TO" feature that comes with sharepoint online has a limit and fails 50% of the time. Migrating files in sharepoint is a nightmare and barely possible.
    – Michael
    Jan 30, 2019 at 13:39
0

You can try increase list view threshold.

Here is answer how to change it

SP2013 List view threshold changed

1
  • 2
    not possible on SharePoint Online
    – Michael
    Jan 31, 2019 at 3:42
0

you can use this script with proper editation for updating thousands of documents of items, just use Query collections and index:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client") #| Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime") #| Out-Null
Add-Type -Path "c:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.Online.SharePoint.Client.Tenant.dll"
cls

$username = "[email protected]"
$password = ConvertTo-SecureString "" -AsPlainText -Force

$siteUrl = [string]::Format("https://company.sharepoint.com/sites/site1/")
$cc = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
$cc.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)

$list = $cc.Web.GetList("/sites/site1/Lists/List1")
$cc.Load($list);
$cc.ExecuteQuery();

$query = New-Object Microsoft.SharePoint.Client.CamlQuery
$query.ViewXml = "<View><RowLimit>100</RowLimit></View>"
$i = 1
$y = 0

do
{
    Write-Host "Round $i" -ForegroundColor DarkYellow
    $listItems = $list.GetItems($query);
    $cc.Load($listItems);
    $cc.ExecuteQuery();
    foreach($item in $listItems)
    {      
            Write-Host "Updating item $($item.Id)" #"$($item.DisplayName)" -ForegroundColor Yellow
            # Update item here
            $item.Update()
            $y++

            if($y -eq 10)
            {
                $cc.ExecuteQuery()
                $y=0
            }
    }
    $query.ListItemCollectionPosition = $listItems.ListItemCollectionPosition
    $i++
}
while ($query.ListItemCollectionPosition -ne $null)

Hope it helps!

2
  • this looks like it updates every file/folder in the document library? what hapens if someone puts a new file or new folder in that doc library, it wil inherit the permission from the doc library.. so I'd need to run this script nighty?
    – Michael
    Jan 31, 2019 at 3:43
  • probably yes, but after first running you can change the Query and add filter that Created is not lower than yesterdays date, so you will iterate and update only new items. Jan 31, 2019 at 7:41
0

I would also say you should check if there are many documents within the library that have unique permissions. If you then find this is a problem, have a look at this article Solutions and workarounds for SharePoint permission limits.

If not, check Software boundaries and limits for SharePoint

0

Microsoft say you can't break permissions once you are over 100000 items

https://support.office.com/en-us/article/customize-permissions-for-a-sharepoint-list-or-library-02d770f3-59eb-4910-a608-5f84cc297782

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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