2

There is an undocumented API /_vti_bin/homeapi.ashx/sites/followed that returns the list of followed sites for the currently logged in user. This one does not seem to be useful due to permission-related limitations.

There is also a Graph API endpoint: https://graph.microsoft.com/beta/users/Admin@Contoso.onmicrosoft.com/followedSites

But it gives me access denied: enter image description here

PnP SharePoint PowerShell Script

$AppSecret = 'XXXXX*[ZLq9Q3VFOwXGRm2NSP'
$appId = 'fb32c27b-XXXXX-4824-8af0-e8d303553d9e'
$AADDomain = 'contosoTenant.onmicrosoft.com'

Connect-PnPOnline -AppId $AppId -AppSecret $AppSecret -AADDomain $AADDomain
$accesstoken = Get-PnPAccessToken
$response = Invoke-RestMethod -Uri 'https://graph.microsoft.com/beta/users/Admin@contosoTenant.onmicrosoft.com/followedSites' -ContentType "application/json" -Headers @{Authorization = "Bearer $accesstoken"} -Method Get

Permissions assigned to the AAD App:

enter image description here

Question

Is there a way to retrieve the list of followed sites for a specific user using REST API, Graph or some other way?

Explanation

We are going to need to write a crawler that runs every day and for every user in Office 365, gets the list of followed sites. This will later be used for a separate email notifications feature. But first, I am trying to understand if it's even possible to get users' followed sites.

Any help will be greatly appreciated!

Edit There is a similar question about SharePoint on-prem here, but we are using Office 365, which makes this question different.

2
  • 2
    That other question is about sp 2013 this is SPO and Graph API, don't think this is duplicate. – Marek Sarad Oct 1 '19 at 9:12
  • Hey Denis. did my answer help u? thanks :9 – Alberto S. May 12 '20 at 7:30
1

Taking a look to the Microsoft Graph API documentation, if you go to the "sites" related v1.0 reference, you will notice you can perform a query like the one below:

https://graph.microsoft.com/v1.0/users/{user-id}/followedSites

Here is an example:

https://graph.microsoft.com/v1.0/users/5d0191d0-1165-4a89-fc96-3000081209fa/followedSites

That query will return the followed sites for that target user, based on its ID.

PS: for retrieving the sites followed by the current user, just query:

https://graph.microsoft.com/v1.0/me/followedSites

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.