0

The list we have has a threshold limit of 5000 items. To avoid the qeury error, we created the folder structure in the list and saving the items into the folders.

But even then when we try to query the list, we get the threshold limit error.

I read about querying using the folder name but that seems to be applicable to document libraries. Is that true?

Is there a way to query a list with folder structure but crossed the threshold limit?

1
  • is columns are index on which you are querying? Nov 25, 2022 at 12:19

1 Answer 1

0
  • Identify the column which you want to query in list and make it indexed column
  • Below are the piece of code which you can you use to iterate the item form folder.
// Get root folder of a library
IFolder folder = await context.Web.Folders.GetFirstOrDefaultAsync(f => f.Name == "SiteAssets");

// Get root folder of the web (for files living outside of a document library)
IFolder folder = (await context.Web.GetAsync(p => p.RootFolder)).RootFolder;

// Get folder collection of a web and pick the SiteAssets folder
await context.Web.LoadAsync(p => p.Folders);
var folder = context.Web.Folders.AsRequested().FirstOrDefault(p=>p.Name == "SiteAssets");

// Load files property of the folder
await folder.LoadAsync(p => p.Files);

foreach(var file in folder.Files.AsRequested())
{
    // Do something with the file
}

For more details refer this docs.

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.