pnp / pnp/pnpframework

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

Open
#977 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
259
Forks
161
Avg merge
10h 33m
Merged PRs (30d)
1

Description

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:

https://github.com/pnp/pnpframework/blob/fc213f2f2db338c776890ba4ff176d08b5ec5189/src/lib/PnP.Framework/Extensions/FileFolderExtensions.cs#L913-L916

Also, I guess that this is related to https://github.com/pnp/powershell/issues/2286.

Steps to reproduce:

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/lib/PnP.Framework/Extensions/FileFolderExtensions.cs around lines 913-916 and trace EnsureFolderPath, EnsureFolderPathAsync, and EnsureFolderPathImplementation as used by Resolve-PnPFolder. Reproduce with the provided PowerShell loop creating 5,005 subfolders, then verify that the folder-path operations no longer fail with the list view threshold error.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.