Problems using MT Enhanced through SDL Project Automation API, works in Studio.

I am creating an external .NET application that uses a Project Template to setup a project, add files from a directory, attach a TM, and then use the MT Enhanced plugin. The Pre-translate Files task is configured so that when no match is found, "Apply automated translation". When we create a New Project and run the Pre-Translate Batch Task through Studio (we are on 2015), it works perfectly. We can see what the TM did and also what the MT did. However, when I try to do it in my application, I am received an error:

{"Unexpected exception when initializing task 'Analyze Files': Authentication failed for translation provider 'mtenhancedprovider:///?sendplaintextonly=False&selectedprovider=Microsoft+Translator&usecatid=False&catid=65c5ca74-d991-4f3f-9374-224861807990-en-US-es-MX-TMX-CUSTOM&resenddrafts=False&usepreedit=False&usepostedit=False&prelookupfilename=&postlookupfilename='.."}

Is there an additional setting that is needed when attempting to use the MT Enhance programmatically? Or will it only work when the task is executed via Studio?

Parents Reply
  • Is there any solution for this problem? 

    <CascadeEntryItem PerformConcordanceSearch="false" Penalty="0" PerformUpdate="false" PerformNormalSearch="true">
          <MainTranslationProviderItem Uri="mtenhancedprovider:///?sendplaintextonly=False&selectedprovider=Microsoft+Translator&usecatid=False&catid=&resenddrafts=False&usepreedit=False&usepostedit=False&prelookupfilename=&postlookupfilename=" State="{"LanguagesSupported":{}}" Enabled="true" />
        </CascadeEntryItem>

    error message:

    Unexpected exception when initializing task 'Analyze Files': Failed to create an instance of translation provider 'mtenhancedprovider:///?selectedprovider=Microsoft+Translator&sendplaintextonly=False&usecatid=False&catid=&resenddrafts=False&usepreedit=False&usepostedit=False&prelookupfilename=&postlookupfilename='..

    code: 

                    Uri uri = new Uri("mtenhancedprovider:///?sendplaintextonly=False&selectedprovider=Microsoft+Translator&usecatid=False&catid=&resenddrafts=False&usepreedit=False&usepostedit=False&prelookupfilename=&postlookupfilename=");    
                    string credential = "API-KEY";
                    string state = "{"LanguagesSupported":{}}";
                    
                     private static void AddMTTranslationProvider(FileBasedProject project, Uri uri, string credential, string state)
     {
         TranslationProviderConfiguration tpConfig = project.GetTranslationProviderConfiguration();
    
         //tpConfig.Entries.Clear(); 
    
         tpConfig.Entries.Add
         (
             new TranslationProviderCascadeEntry
             (
                 new TranslationProviderReference(uri, state, true), false, true, false, 0
             )
         );
    
         project.UpdateTranslationProviderConfiguration(tpConfig);
    
         project.Credentials.AddCredential(uri, credential);
    
         ISettingsBundle settings = project.GetSettings();
         TranslationMemorySettings tmSettings = settings.GetSettingsGroup<TranslationMemorySettings>();
         project.UpdateSettings(settings);

Children
No Data