In this post we will discuss about how we can get followers as well as followed by people by using .Net client object model in SharePoint 2013. Also you can check out my previous posts on:
Below is the full code:
ClientContext clientContext = new ClientContext("http://URL");
SocialFollowingManager followingManager = new SocialFollowingManager(clientContext);
SocialActorInfo actorInfo = new SocialActorInfo();
actorInfo.AccountName = "domain\\username";
//By using the GetFollowed method you can get the people who the current user is following.
ClientResult<SocialActor> followedResult = followingManager.GetFollowed(SocialActorTypes.Users);
//By using the GetFollowers() method you can get the people who are following the current user.
ClientResult<SocialActor> followersResult = followingManager.GetFollowers();
Once you get the resultset you can iterate like below:
foreach (SocialActor actor in followedResult)
string name = actor.Name;
string imageURL = actor.ImageUri;