2

I would like to display the content of the "Sites I'm following" web part on my main page.

I know that the web part itself can not be exported.

Is there any way of doing this?

  • Is there an option to get the below using REST API for the current user? 1) all the sites I am member of 2) all the sites I am owner of 3) Frequent sites – Amal Fernando Jan 2 '18 at 17:34
5

Yes. You can achieve this by simply creating a REST api call to fetch the Sites I'm following list data inside a Script Editor Web Part or Content Editor Web Part.

Take a look at this article, it has the explained code for retrieving the list of sites I'm following.

Refer below snippet code that you can use if above link doesn't work:

var siteURL = "<your site url>";
$.ajax({  
   url: siteURL + "/_api/social.following/my/followed(types=14)",  
   headers: {   
      "accept": "application/json;odata=verbose"  
   },  
   success: function(){ /* Your Success function Goes Here - DOM Manipulation to show the results of sites */},  
   error: function() { /* Your Error function Goes Here*/}
});  

You can check this MSDN article for more reference.

  • Thank you for your response, I can know display a list of sites I'm following. However, I can't click on the links. Is it possible to make that happen? – Zoppe Jul 10 '15 at 11:42
  • Yes, that is also possible. You can simply create a tag with href and that attribute contain it's redirection url. You need to parse the response of that REST call response. – Pradip R. Jul 10 '15 at 11:44
  • Ok, thanks. I'm not good at writing code at all so could you help me, if you have the time? Also the code from the article you provided displays not only sites but also documents and tags that the user is following. I only want the sites and I looked at the code and in the "Get the content that the current user is following" section, it uses the "types=14" parameter to get all content types. Do I just replace 14 with the parameter for sites? – Zoppe Jul 13 '15 at 8:29
0

Another approach could be to leverage the content by search or search results webparts showing a list of sites that is filtered by the list of sites the user is following. Although OOTB the search web parts don't include a query variable to establish this, I have created a content editor / script editor based solution to facilitate this using a custom token "{FollowedSites}". See my answer here: SharePoint 2013: Filter search results to only display content that I'm following

If this works, maybe you could then customize the search webparts further yourself?

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.