Server bases TMs problem - cannot authorize properly when using SDK

Hi, 

I am unable to run some automatic tasks using API. Error in trados on screen below.

Screenshot of Studio Developers Q&A error dialog with multiple error messages. The first error is 'Unexpected exception when configuring the API...' related to Translation Memory configuration. Other errors are stack traces indicating issues with 'TranslationProviderCascadeEntry' and 'TranslationProviderReference'.

Code adding TM to the project is as below:

{code}

TranslationProviderConfiguration tmConf = fileBasedProject.GetTranslationProviderConfiguration(projectTargetLanguage);
tmConf.OverrideParent = true;

TranslationMemoryIdentification identification = getById(new Guid(resource.id), apiUrl, userName,
password);
var normalizedUri = apiUrl.TrimEnd(new char[] {'/'});

tmConf.Entries.Add(
(
new TranslationProviderCascadeEntry
(
new TranslationProviderReference(new Uri(String.Format("sdltm.{0}?orgPath={1}&tmName={2}", normalizedUri, identification.organization, identification.name))),
true,
true,
true,
0
)
));
string credential = String.Format("user={0};password={1};type=CustomUser", userName, password);
log.Info("Credential:" + credential);
fileBasedProject.Credentials.AddCredential(new Uri("sdltm."+apiUrl), credential);
fileBasedProject.UpdateTranslationProviderConfiguration(projectTargetLanguage, tmConf);
fileBasedProject.Save();

{code}

However if I skip this task, and run it in Trados, then all works fine.

What am I doing wrong here ?



Generated Image Alt-Text
[edited by: RWS Community AI at 6:45 AM (GMT 0) on 15 Nov 2024]
Parents Reply Children