-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Write permission is required to read SharePoint folders #1583
Comments
I'm still trying to wrap my head around the SDK and the models, and I may have misunderstood Folders. But I still don't think I should be getting a 403 when reading with read-only access. |
@ianleeder It is not an issue with the PnP Core SDK. That's how the SharePoint works, I believe. Web.Folders contains a lot of system folders, which seem to be unavailable with just Read access level. I would say it's quite an unusual use case to load Web.Folders. If you could explain what you are trying to achieve, I might be able to help you move in the right direction. Maybe you want to get all folders in a specific library, or all libraries? |
Correct @maximkol, I was attempting to look for a specific folder that existed in a library. I've since worked out that I need to load lists, then get the folders in the list. My code is working now. It was unclear for someone new to the SDK that I still think there should be some sort of documentation to indicate better that library folders are not folders, and that you require write access to read folders. |
Unless you have specific requirements for the SPFolder object, you will likely find all you need in the Microsoft Graph API: The behavior of Graph (and its URL segmenting) might align better with you understanding. (And, folders can be read using a Read permissions). |
Category
Describe the bug
I'm not sure if this will be a PnP bug, or a SharePoint API. But if I attempt to list folders using an App Registration that only has permission
Sites.Read.All
I get the following 403 error:Reading lists with read-only works fine, and reading folders with read-write works.
Sites.Read.All
Sites.ReadWrite.All
var lists = await context.Web.Lists.ToListAsync();
var folders = await context.Web.Folders.ToListAsync();
Steps to reproduce
Sites.Read.All
Expected behavior
Given that I am only reading folders from SharePoint, I expect to be able to do this with read-only permission. If this is not possible for some technical reason, I expect that it is clearly and boldly indicated in the documentation, and in the exception.
Environment details (development & target environment)
The text was updated successfully, but these errors were encountered: