Forum Discussion
Approaches to migrate the Likes from an on-premise discussion board list to sharepoint online
Hey john john ,
Yeah I know what you mean when you say it is hard to change the way things work when it comes to big companies. I still think it could be worth having a word with the managers about the benefits of migrating to a new platform. I wouldn't recommend the comments section either. As you mentioned, there's still a lot of work to be put in there.
Anyway, if you want to stick to Discussion Board and have your likes migrated, there may be a way out, although I don't think it would be trivial. First, are using the same AD that you use in your on-prem Sharepoint? If so, can you also check if a user has the same ID both in Sharepoint on-prem and Sharepoint Online?
If the user has the same ID in both versions, then your task would be much easier, although I don't think that would happen. Lemme know if you need any help.
Regards,
Deleted wrote:Hey john john ,
Yeah I know what you mean when you say it is hard to change the way things work when it comes to big companies. I still think it could be worth having a word with the managers about the benefits of migrating to a new platform. I wouldn't recommend the comments section either. As you mentioned, there's still a lot of work to be put in there.
Anyway, if you want to stick to Discussion Board and have your likes migrated, there may be a way out, although I don't think it would be trivial. First, are using the same AD that you use in your on-prem Sharepoint? If so, can you also check if a user has the same ID both in Sharepoint on-prem and Sharepoint Online?
If the user has the same ID in both versions, then your task would be much easier, although I don't think that would happen. Lemme know if you need any help.
Regards,
yes both the on-premises and online have the same AD...
- AnonymousFeb 20, 2019
Ok, so I will post a possible solution here, lemme know if it helps.
A made a REST call the a discussion board I created (https://tenant.sharepoint.com/_api/web/lists/getbytitle('Discussion Board')/items?) and if you put the result in a XML formatter you will be able to see that the items in the discussion board have two specific properties, LikesCount and LikedByStringId. So I believe that, in order to replicate the Likes, you would a solution that gets all items, pick these values, and save them to the items in your new list at Sharepoint Online. Mind you that, meanwhile your users are from the same AD, they may not have the same ID at Sharepoint. So the Id's referenced in the LikedByStringId field will need to be "translated" to the respective Id's of the same users at Sharepoint Online. My step-to-step to the code would be something like:
- Gets all the users at old tenant, saving them in a Data structure. Let's call it Users1[].
- Gets all items at the old Discussion board list, saving it in a Data sctructure too. Let's call it DB1[].
- Gets all the users at new tenant, saving them in a Data structure. Let's call it Users2[].
- Gets all items at the new Discussion board list, saving it in a Data sctructure too. Let's call it DB2[].
- Loop through DB1[] and for every item gets the respective item in DB2[], assuming the lists have the same items. Then you copy the value of LikesCount and LikedByStringId from DB1 to DB2. However, you have to "resolve" the Id's in the LikedByStringId to Ids corresponding to your new tenant, using Users1 and Users2. You can maybe use the LoginName of the user for that.
- After resolving the new Ids, store them at DB2[] and save the items in DB2[] to your new tenant again. That should update Likes at your new list.
Well I know that may sound cumbersome, so if you have any questions let me know.
Regards,