How to get sites of a certain type using CSOM?

I am making an application that connects to SharePoint 2013. I am using CSOM to work with SharePoint. I want to display the news on a site (team site) that follows the current user.

To get the feed, I implement the next step:

  • First, I get a list of the following users from SocialFollowingManager .
  • Further, with information about sites, I get information about site news.

When I get a list of subsequent sites (first step above), I can get blog sites as well as team sites. I want to get only Team Sites.

Is there a way to get only Team Site (team site template)?

+4
source share
2 answers

Unfortunately, the Social API only provides a list of sites. You will have to manually filter from there to determine which sites need to be displayed. This is not ideal, but it is a limitation in the API.

0
source
 ClientResult<SocialActor[]> socialActors = new SocialFollowingManager(clientContext).GetFollowed(SocialActorTypes.Sites | SocialActorTypes.ExcludeContentWithoutFeeds); 

This will give you every site, with the exception of those who do not have feeds, i.e. Teamsites

Hope this helps!

0
source

All Articles