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
    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 at 16:00
0

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

  • not possible. this doc library has well over 100,000 files. – michael Jan 29 at 23:04
  • Not a problem with Powershell as your friend – Kasper Bo Larsen Jan 30 at 5:21
  • Powerhsell using CSOM same as C# code, so i dont think this will help. – michael Jan 30 at 13:39
  • It does, the trick is to get fewer than 5000 items, then you will be able to modify the library – Kasper Bo Larsen Jan 30 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.

  • 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 at 13:39
0

You can try increase list view threshold.

Here is answer how to change it

SP2013 List view threshold changed

  • 1
    not possible on SharePoint Online – michael Jan 31 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 = "login@domain.com"
$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!

  • 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 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. – Zdeněk Vinduška Jan 31 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

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.