Sharepoint 2013 / 2016 : Migrating User Comments

You might have heard about the OOB webpart 'NoteBoard'. The Note Board is a pretty useful web part you can add to any page that can take web parts. It allows you to store comments in the social database against that page using it’s URL – just like the Tags and Notes button in the ribbon. This feature will work as expected when the comments are in the same page (that means same URL). The comments will NOT be visible when you move the content to a different URL , that means if you dismount the DB and mount it again to a different web application with a different URL. A common scenario is : Migrating from Sharepoint 2013 to Sharepoint 2016. Imagine that the Sharepoint 2013 URL is http://sp2013 and the DB is now moved to Sharepoint 2016 web application that has a URL http://sp2016, the comments will NOT be shown !

In my test case, I use the URL , where the comments are added to a page "/SitePages/Comments_test.aspx"

I have 4 users added some comments to the page. Lets see how this is saved in the Social Database

Note : The Table dbo.urls stores all the URLS where the comments are added and a URLID is associated with it. The same URLID is referenced when saving the comments in the dbo.socialComments table. The field User_recordID refers to the user who added the comments and this information is referred from dbo.userprofile_full table in the corresponding Profile DB.

Now, lets consider the scenario of migration from SP 2013 to SP2016. The Profile DB and Social DB are migrated to SP2016 and have a User profile service application up and running. The Content Database also migrated to SP2016 , but the comments are not visible as the Social Comments table still contains old URL and it doesn't exists any more.

Now, lets execute the following Sharepoint Powershell commands.

Get-SPServiceApplicationProxy #copy the ID of UPA proxy<br>$upaProxy = Get-SPServiceApplicationProxy <br>Move-SPSocialComment -ProfileServiceApplicationProxy $upaProxy -OldUrl "" -NewUrl ""  

Now, the comments appears in the site

Lets see what changed in the Social DB now.
It creates a new entry in the dbo.urls table with a new URLID and the new URLID is mapped in the dbo.socialcomments table.

You may use this to build a Powreshell script that can innumerate through a list of old and new URLs and replace them if there are multiple URLs to be migrated.

POST BY : Manjesh Menon [MSFT]