admin管理员组

文章数量:1202391

I created an app and granted it SharePoint REST API permission (not Graph API), specifically SharePoint.Read.All.
In the SharePoint Admin Center, I created a new site (let's call it "Site A").

When I tried to fetch the list details from this main site, I received an UnauthorizedAccessException.

However, when I created a subsite under this site (let's call it "Subsite A") and used the same app and code, it was able to fetch the lists successfully.

To fetch all lists of the main site, I had to grant the Sites.FullControl.All permission.

Why is this behavior occurring? I tested with different site types, but the behavior is consistent—working with subsites but not with the main site. Is it even possible to fetch the SharePoint lists of a main site without using FullControl?

Tested with differnt sites types.

I created an app and granted it SharePoint REST API permission (not Graph API), specifically SharePoint.Read.All.
In the SharePoint Admin Center, I created a new site (let's call it "Site A").

When I tried to fetch the list details from this main site, I received an UnauthorizedAccessException.

However, when I created a subsite under this site (let's call it "Subsite A") and used the same app and code, it was able to fetch the lists successfully.

To fetch all lists of the main site, I had to grant the Sites.FullControl.All permission.

Why is this behavior occurring? I tested with different site types, but the behavior is consistent—working with subsites but not with the main site. Is it even possible to fetch the SharePoint lists of a main site without using FullControl?

Tested with differnt sites types.

Share Improve this question asked Jan 21 at 7:51 AmitAmit 759 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

The behavior you're experiencing is likely due to the permissions model in SharePoint. The SharePoint.Read.All permission allows your app to read items in all site collections, but it may not grant access to the main site collection in certain contexts, especially if there are additional security settings or restrictions in place.

When you created a subsite, the permissions model may have allowed the app to inherit permissions from the parent site, which is why you were able to fetch the lists successfully. However, the main site may have specific permissions that restrict access, resulting in the UnauthorizedAccessException.

To fetch all lists of the main site without encountering permission issues, granting Sites.FullControl.All is indeed a more comprehensive approach, as it provides the necessary permissions to manage and access all aspects of the site, including lists.

In summary, while it may be possible to fetch lists from the main site with the right permissions, the SharePoint.Read.All permission alone may not suffice due to the specific security configurations of the main site.

本文标签: Issue with Fetching SharePoint Main Site Lists Using SharePointReadAll PermissionStack Overflow