RegisterRecord and TranslateColumn - MEDIAFILE and NODE types

Lance Johnson asked on May 23, 2016 20:38

I'm staging a custom table that acts as an XREF table using Media File and Tree Node IDs.

I followed the documentation using TranslationHelper.RegisterRecord and TranslationHelper.TranslateColumn but it's not clear what to use for the CodeName value for these types when registering for translation.

MediaFileInfo.TYPEINFO.CodeNameColumn and TreeNode.TYPEINFO.CodeNameColumn are both null so I'm not sure how it's supposed to look up the records on the target to do the translation.

Quick and dirty sample code I'm talking about (inside ColumnsTranslationEvents.RegisterRecords.Execute handler):

// Media file info
int fileID = ValidationHelper.GetInteger(e.Data.GetValue("FileID"), 0);
var info = MediaFileInfoProvider.GetMediaFileInfo(fileID);
var codeName = info.GetStringValue(MediaFileInfo.TYPEINFO.CodeNameColumn, string.Empty);
e.TranslationHelper.RegisterRecord(PredefinedObjectType.MEDIAFILE, fileID, codeName, 0);

Recent Answers


Roman Hutnyk answered on May 23, 2016 23:21

In case you've staged all documents and media files use GUID's for both. You have to use anything that is equal on both sides and unique.

0 votesVote for this answer Mark as a Correct answer

Lance Johnson answered on May 24, 2016 01:13

It was my understanding it depended on the CodeNameColumn specifically to do the lookup on the target using TranslationHelper.TranslateColumn but we can try to work with the GUID.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.