Get all SharePoint URLs to which a given user has access to using Graph API

Vish Pothaganti 66 Reputation points
2022-01-20T20:08:21.36+00:00

Hello,

I'm trying to get a list of all SharePoint Site URLs to which a given user has access to.

I would have the email address of a user and I would want to present a list of sites that user have access to. Is there any Graph API endpoint which can provide these details??

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,690 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
3,682 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2022-01-21T02:47:24.297+00:00

    Hi @Vish Pothaganti ,
    With Graph api, you can only get the groups that the user is a memeber of: https://learn.microsoft.com/en-us/graph/api/user-list-memberof?view=graph-rest-1.0&tabs=http

    For Rest api, the scope is site, so you can only get the information of one site.

    The best way is using search api, sign in as that user, _api/search/query?querytext='contentclass:STS_Site contentclass:STS_Web' .The user would get a list of the site he could access to.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.