Forum Discussion

Dominic Horne's avatar
Dominic Horne
Brass Contributor
Jul 12, 2018

Office 365 - Retrieve all sites a user has access to

What is the best way to retrieve all sites a user has access to in Office 365 using a script that runs outside Office 365 and how do we simulate user authentication ?

Can a solution be implemted using SharePoint search APIs or the Microsoft Graph ?

4 Replies

  • Is there information somewhere on how to set this up?

  • You don't need to simulate user authentication, just use a user with the required permissions to get for each user the sites he can access. I would recomend to use Search API for this requirement
    • Dominic Horne's avatar
      Dominic Horne
      Brass Contributor
      Azure AD app regustration has permissions that allow an app to Search as another user for O365 SharePoint Online.
    • Dominic Horne's avatar
      Dominic Horne
      Brass Contributor
      The requirement is that a manger can see a report of the sites that his subordinate has access to.

      Can you please shed some light on how to achieve this? How do we simulate the user executing the API query?
      “use a user with the required permissions to get for each user the sites he can access.”