Hi
Earlier this year I posted about not being able to re-import bilingual review docs (docx) back into my project. After leaving the code for a few months I am back into it. I've got the following code which is my attempt to perform this task.
As you can see, I am saving the project after I have attached the files to be imported.
The program runs, and the status of the UpdateFromExternalReview task is Completed.
Yet it does not perform the import (there are visible changes in the DOCX file that are not showing up in the SDLXLIFF after the program completes).
I know it's a big ask but can someone check this code out and point out why it's not working as expected?
TIA
Mark
List<TaskStatusEventArgs> taskStatusEventArgsList = new List<TaskStatusEventArgs>();
List<MessageEventArgs> messageEventArgsList = new List<MessageEventArgs>();
ProjectFile[] targetFiles = project.GetTargetLanguageFiles(trgLang);
ISettingsBundle settings = project.GetSettings(trgLang);
ImportFromReviewTaskSettings importTaskSetting = settings.GetSettingsGroup<ImportFromReviewTaskSettings>();
Console.WriteLine("Setting mappings: {0} to {1}", targetFiles[0].LocalFilePath,
@"C:\TRANSLATION-REVIEWS\ERPX 2023QXXX\de-DE\DE\External Review\de-DE\Keyboard_navigation.htm.review.docx");
ExternalReviewMappingItem mappingItem = new ExternalReviewMappingItem(targetFiles[0].LocalFilePath, project.GetProjectInfo().Id, reviewdocsfolder + "\\Keyboard_navigation.htm.review.docx");
mappingItem.Language = trgLang;
mappingItem.Guid = targetFiles[0].Id;
var mappings = new List<ExternalReviewMappingItem>();
mappings.Add(mappingItem);
importTaskSetting.ExternalReviewMappingItems.Value = mappings;
importTaskSetting.Backup.Value = false;
importTaskSetting.ConfirmationLevel.Value = ConfirmationLevel.ApprovedTranslation;
project.UpdateSettings(trgLang, settings);
List<ProjectFile> targetFilesList = new List<ProjectFile>();
targetFilesList.Add(targetFiles[0]);
targetFiles = targetFilesList.ToArray();
project.Save();
AutomaticTask update = project.RunAutomaticTask(targetFiles.GetIds(), AutomaticTaskTemplateIds.UpdateFromExternalReview);
CheckEvents(taskStatusEventArgsList, messageEventArgsList);
Console.WriteLine("\tUpdateFromExternalReview - status = " + update.Status.ToString());
ExecutionMessage[] errors = update.Messages;
foreach (ExecutionMessage error in errors)
Console.WriteLine(error.Message);
project.Save();