pnp / pnp/pnpframework

Folders returning null

Open
#753 0 comments 0 reactions 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

I'm trying to use the code from this article: https://pnp.github.io/pnpcore/using-the-sdk/files-intro.html#enumerating-files to get a list of files from a document library:

`// Get root folder of a library
IFolder folder = await context.Web.Folders.FirstOrDefaultAsync(f => f.Name == "Documents");

// Load files property of the folder
await folder.LoadAsync(f => f.Files);
foreach (var file in folder.Files.AsRequested())
{
// Do something with the file
Debug.WriteLine(file.Name);
}`

However I see that folder is returning null. I'm using interactive login. Not sure what I'm doing wrong.

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 with the linked Files introduction article and reproduce the interactive-login example against a document library. Trace the folder lookup and inspect why it returns null; the issue is done when the root folder resolves and its files can be enumerated as shown.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.