pnp / pnpframework

PnP Framework is a .NET library targeting Microsoft 365 containing the PnP Provisioning engine and a ton of other useful extensions

Home Page:https://pnp.github.io/pnpframework/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Web.EnsureFolderPathImplementation throws "The attempted operation is prohibited because it exceeds the list view threshold."

nils-a opened this issue · comments

Resolve-PnPFolder directly uses the EnsureFolderPathImplementation extension.

When 5000 sub-folders exist in a folder, calling EnsureFolderPath/EnsureFolderPathAsync/EnsureFolderPathImplementation results in the following error:

The attempted operation is prohibited because it exceeds the list view threshold.

I guess this is due to the loading of all sub-folders in a given folder:

// Find next part of the path
var folderCollection = currentFolder.Folders;
folderCollection.Context.Load(folderCollection);
await folderCollection.Context.ExecuteQueryRetryAsync();

Also, I guess that this is related to pnp/powershell#2286.

Steps to reproduce:

Connect-PnPOnline -Interactive "... your site ..."
1..5005 | ForEach-Object { Resolve-PnPFolder -SiteRelativePath "SitePages/testFolder/f_$_" }