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

Vish Pothaganti 66 Reputation points


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.
10,538 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.
2,660 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 30,991 Reputation points Microsoft Vendor

    Hi @Vish Pothaganti ,
    With Graph api, you can only get the groups that the user is a memeber of:

    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.

    2 people found this answer helpful.