Home

Following O365 Sites API

%3CLINGO-SUB%20id%3D%22lingo-sub-45348%22%20slang%3D%22en-US%22%3EFollowing%20O365%20Sites%20API%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-45348%22%20slang%3D%22en-US%22%3E%3CP%3ERef%20this%20post%20%3A%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FOffice-365-Groups%2FFollowing-O365-Group-Sites-excluded-in-API%2Ftd-p%2F28494%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FOffice-365-Groups%2FFollowing-O365-Group-Sites-excluded-in-API%2Ftd-p%2F28494%3C%2FA%3E.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20the%20same%20need%20for%20an%20API%20endpoint%20to%20retrieve%20all%20sites%20i'm%20following%20regardless%20of%20classic%20vs%20o365%20group%20site.%20The%20existing%20API%20%3A%20%3CA%20href%3D%22https%3A%2F%2Fmytenant.sharepoint.com%2F_api%2Fsocial.following%2Fmy%2Ffollowed(types%3D14%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fmytenant.sharepoint.com%2F_api%2Fsocial.following%2Fmy%2Ffollowed(types%3D14%3C%2FA%3E)%20does%20not%20return%20any%20O365%20Group%20Sites.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20post%20refers%20to%20a%20solution%20to%20make%20use%20of%20an%20existing%20http%20handler%3A%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fmytenant.sharepoint.com%2F_vti_bin%2Fhomeapi.ashx%2Fsites%2Ffollowed%3FmostRecentFirst%3Dtrue%26amp%3Bstart%3D0%26amp%3Bcount%3D100%26amp%3BfillSiteData%3Dtrue%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fmytenant.sharepoint.com%2F_vti_bin%2Fhomeapi.ashx%2Fsites%2Ffollowed%3FmostRecentFirst%3Dtrue%26amp%3Bstart%3D0%26amp%3Bcount%3D100%26amp%3BfillSiteData%3Dtrue%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20seems%20to%20give%20me%20the%20needed%20data%20but%20I%20guess%20this%20is%20not%20a%20documented%20approach%3F%20Is%20there%20any%20other%20option%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-280514%22%20slang%3D%22en-US%22%3ERe%3A%20Following%20O365%20Sites%20API%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-280514%22%20slang%3D%22en-US%22%3E%3CP%3EIs%20there%20any%20option%20that%20can%20be%20passed%20in%20the%20url%20to%20text-filter%20the%20results%3F%3C%2FP%3E%3CP%3EI%20ask%2C%20because%20your%20screenshot%20shows%20a%20search%20box.%3C%2FP%3E%3CP%3EOr%20are%20you%20filtering%20the%20results%20after%20the%20api%20response%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-83258%22%20slang%3D%22en-US%22%3ERe%3A%20Following%20O365%20Sites%20API%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-83258%22%20slang%3D%22en-US%22%3E%3CP%3EI%20can%20send%20you%20the%20React%20Component%20%2B%20%22service%22%20that%20returns%20the%20%22followed%20sites%22.%20The%20React%20component%20refers%20to%20other%20libraries%20so%20not%20very%20easy%20to%20send%20full%20working%20code.%20My%20implementation%20just%20display%20a%20list%20and%20is%20not%20that%20fancy%20as%20Brent%20Ellis%20implementation%20for%20filtering%20and%20paging.%20That%20was%20not%20required%20for%20me%20%3A)%3C%2Fimg%3E%20See%20example%20below.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-left%22%20style%3D%22width%3A%20326px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F16577iC6F5AFC96C9339B6%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22ReactExample.jpg%22%20title%3D%22ReactExample.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-81934%22%20slang%3D%22en-US%22%3ERe%3A%20Following%20O365%20Sites%20API%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-81934%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F637%22%20target%3D%22_blank%22%3E%40Brent%20Ellis%3C%2FA%3E%26nbsp%3Band%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F7215%22%20target%3D%22_blank%22%3E%40%C3%96rjan%20Andersson%3C%2FA%3E%26nbsp%3Bwhat%20a%20great%20solution!%20I'm%20looking%20for%20some%20time%20for%20this%20one.%3C%2FP%3E%3CP%3EIs%20there%20a%20(small)%20chance%20to%20get%20the%20code%20for%20this%20webpart%20you%20use%3F%3C%2FP%3E%3CP%3EThanks%2C%3C%2FP%3E%3CP%3ESigi%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-45708%22%20slang%3D%22en-US%22%3ERe%3A%20Following%20O365%20Sites%20API%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-45708%22%20slang%3D%22en-US%22%3E%3CP%3EThanks.%20I%20think%20we%20go%20for%20the%20same%20option%20for%20now.%20%3A)%3C%2Fimg%3E%20Nice%20finding!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-45380%22%20slang%3D%22en-US%22%3ERe%3A%20Following%20O365%20Sites%20API%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-45380%22%20slang%3D%22en-US%22%3E%3CP%3EWe%20made%20the%20same%20modification%20and%20shifted%20to%20using%20this%20url%2C%20like%20you%20mentioned%2C%20not%20really%20formally%20documented%2C%20but%20there%20is%20a%20ton%20that%20isnt.%20%26nbsp%3BThis%20was%20the%20best%20(only%3F)%20option%20we%20were%20able%20to%20find.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eurl%20%3A%20_spPageContextInfo.webAbsoluteUrl%20%2B%20%22%2F_vti_bin%2Fhomeapi.ashx%2Fsites%2Ffollowed%3FmostRecentFirst%3Dtrue%26amp%3Bstart%3D0%26amp%3Bcount%3D100%26amp%3BfillSiteData%3Dtrue%22%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe%20created%20a%20web%20part%20for%20our%20intranet%20homepage%20that%20shows%20these%20sites%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20673px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F10746i8CC7D4A42B1AC7EC%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Picture1.png%22%20title%3D%22Picture1.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Örjan Andersson
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

Highlighted

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?