Feb 23 2018 08:07 AM - edited Feb 24 2018 12:20 AM
Hi, guys!
I use a REST call to retrieve all sites the current user is following, but modern team sites don't show. I get all classic sites and also modern communication sites, but not modern team sites.
Any idea why?
This is my call:
https://[tenant]/_api/social.following/my/followed(types=15)
At this point I use the type 15 to get everything the user is following (according to the SocialActorTypes enumeration found here). I get people, documents, sites and tags, but still no modern team sites.
Any hint or info on this subject would be appreciated. Thanks.
Feb 25 2018 02:53 AM
Just tried your query but at my tenant it returns the modern teamsites.. so maybe it is a private teamsite?
Feb 25 2018 08:56 AM
Hi, Paul, and thanks for your reply.
If you're referring to the Privacy Settings dropdown in the Site Information pane, all my modern team sites are "Public". But no one is returned by my REST call. Are there any other settings needed?
Funny thing is that when I go to the page https://[tenant]/_layouts/15/sharepoint.aspx, I find a "following" section in the left nav. In this section all the sites I'm following appear, regardless of they being classic, communication or what not. It is this behaviour I'm trying to mimic using my REST call. Without any luck, obviously. Any other suggestions?
Feb 27 2018 10:43 AM
Apparently, this subject has been up for discussion before. I found this post which describes my problem in a nutshell. A modern team site uses GROUP as web template and above mentioned post had a solution. Thanks.
The solution in this case was to use a web service instead and call it with a good old XMLHttpRequest. Here's a sample if anyone else have the same issue.
var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function(){ var followedSites = []; if (xhr.readyState==4 && xhr.status==200) { var data = JSON.parse(xhr.responseText); for(var i=0;i<data.Items.length;++i){ followedSites.push({ Acronym: data.Items[i].Acronym, Title: data.Items[i].Title, Url: data.Items[i].Url }); } console.log(followedSites); } }; xhr.open('GET', this.context.pageContext.web.absoluteUrl + '/_vti_bin/homeapi.ashx/sites/followed?mostRecentFirst=true&start=0&count=100&fillSiteData=true', true); xhr.send();
Feb 27 2018 10:38 PM
Maybe @VesaJuvonen can help with this issue. Or there must be made a ticket as i think the url is OK