Hi, guys
I was trying to write a small JavaScript function to unfollow a document in SharePoint 2013. I thought this was pretty straight forward, but when I run my code nothing happens. No error in the console log, but the document isn't unfollowed. Clearly I'm missing something.
I've debugged each line of code. I get a context object, a following manager and an actorInfo object. All objects variables seemes okay, i.e. not "undefined". Can someone please have a quick look and tell me what I'm doing wrong?
Here's my code:
function unfollowDoc(url) {
var clientContext = SP.ClientContext.get_current();
var followingManager = new SP.Social.SocialFollowingManager(clientContext);
var actorInfo = new SP.Social.SocialActorInfo();
actorInfo.ContentUri = url;
followingManager.stopFollowing(actorInfo);
}