I have a usercontrol and inside its ascx.cs file I would like to do a check(if) if current user is following the current site.
How can I accomplish that?
So far I have done something like this:
SPSite currentSite = SPContext.Current.Site; SPServiceContext context = SPServiceContext.GetContext(currentSite); var currentUser = SPContext.Current.Web.CurrentUser.LoginName; var profile = new UserProfileManager(context); var user = profile.GetUserProfile(currentUser); SPSocialFollowingManager followingManager = new SPSocialFollowingManager(user, context);
SPSocialFollowingManager have a method called
IsFollowed() which determines whether the current user is following the specified actor.
I guess that I need to use that one?
Any kind of help is appreciated