Question

I have an upcoming change of default URL of a customer's production environment. When I've tried this in my dev environment I've run into a major problem with the "Following" functionality. There seems to be 2 problems:

  1. After URL change, all the links on the page "Sites I'm following", under Sites in the suite bar are broken. Or rather, they are not changed from the previous URL, what should be http://newurl is http://oldurl. To Unfollow and the follow again seems to fix it, but I would rather have to not script that
  2. If I use the MySite news feed and change the target to some site I'm following, then the post does show up in the site feed, but in my own personal feed the link to the site is wrong. Again, unfollowing and following again seems to fix new links, but not old ones in the feed.

Is there some way to fix this without a script to refollow for EVERY user and every site? Some timerjob or something like that?

Was it helpful?

Solution

As far as I know, there is not timer job that fixes that. You'll need a script for that. Alternatively, you can ensure that the old url still works (by redirecting or something like that, all new followings will be right)

There is a social API in SharePoint 2013. What you have to do, is to iterate through all users and unfollow the sites with the old url and follow the same sites with a new url. Here is an example for unfollowing a site for a user: SharePoint 2013 Unfollow Site using CSOM

SocialActorInfo actorInfo = new SocialActorInfo();
actorInfo.ContentUri = siteToStopFollow.Url;
actorInfo.ActorType = SocialActorType.Site;
// Find out whether the current user is following the target item.
ClientResult isFollowed = followMgr.IsFollowed(actorInfo);

// Get the information from the server.
clientContext.ExecuteQuery();

bool isFollowing = isFollowed.Value;

if (isFollowing)
{
    followMgr.StopFollowing(actorInfo);
    clientContext.ExecuteQuery();
}

Here is a code how to follow a site for a specific user. An answer in SharePoint StackExchange: How to follow a site using CSOM

//...
actorInfo.AccountName = targetUser.LoginName;
//...
manager.Follow(actorInfo);
//...
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top