Following O365 Sites API

Occasional Contributor

Ref this post :

https://techcommunity.microsoft.com/t5/Office-365-Groups/Following-O365-Group-Sites-excluded-in-API/....

 

 

I have the same need for an API endpoint to retrieve all sites i'm following regardless of classic vs o365 group site. The existing API : https://mytenant.sharepoint.com/_api/social.following/my/followed(types=14) does not return any O365 Group Sites.

 

The post refers to a solution to make use of an existing http handler:

https://mytenant.sharepoint.com/_vti_bin/homeapi.ashx/sites/followed?mostRecentFirst=true&start=0&co...

 

This seems to give me the needed data but I guess this is not a documented approach? Is there any other option?

5 Replies

We made the same modification and shifted to using this url, like you mentioned, not really formally documented, but there is a ton that isnt.  This was the best (only?) option we were able to find.

 

url : _spPageContextInfo.webAbsoluteUrl + "/_vti_bin/homeapi.ashx/sites/followed?mostRecentFirst=true&start=0&count=100&fillSiteData=true",

 

We created a web part for our intranet homepage that shows these sites

 

Picture1.png

Thanks. I think we go for the same option for now. :) Nice finding!

@Brent Ellis and @Örjan Andersson what a great solution! I'm looking for some time for this one.

Is there a (small) chance to get the code for this webpart you use?

Thanks,

Sigi

I can send you the React Component + "service" that returns the "followed sites". The React component refers to other libraries so not very easy to send full working code. My implementation just display a list and is not that fancy as Brent Ellis implementation for filtering and paging. That was not required for me :) See example below.

 

ReactExample.jpg

 

 

Is there any option that can be passed in the url to text-filter the results?

I ask, because your screenshot shows a search box.

Or are you filtering the results after the api response?