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/[email protected]/followedSites
But it gives me access denied:
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/[email protected]/followedSites' -ContentType "application/json" -Headers @{Authorization = "Bearer $accesstoken"} -Method Get
Permissions assigned to the AAD App:
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.