AlignTranslationUnits function in TM API throws "Specified method is not supported"

Hi all,

 

I am writing a small tool to batch update TMs for upLift. But I am not able to run the AlignTranslation units function. This is my code - I cannot see what I am doing wrong. I also saw there is a similar plugin on gitHub, but I would like to create an external tool that allows to do this outside of Studio. I am writing in vb.net and here is my code:

'creating and configuring TM

Dim NewTM As String = UpdatedTMsPath & "\" & File.ToString
Dim NewFileBasedTM As New Sdl.LanguagePlatform.TranslationMemoryApi.FileBasedTranslationMemory(NewTM, "", CultureInfo.GetCultureInfo(SourceLng), CultureInfo.GetCultureInfo(TargetLng), FuzzyIndexes.SourceWordBased, BuiltinRecognizers.RecognizeAll, TokenizerFlags.DefaultFlags, WordCountFlags.DefaultFlags, supportsAlignmentData:=True)
NewFileBasedTM.FGASupport = FGASupport.Automatic
NewFileBasedTM.Save()

'running import of TMX into TM

Dim TMImporter As New Sdl.LanguagePlatform.TranslationMemoryApi.TranslationMemoryImporter(NewFileBasedTM.LanguageDirection)
AddHandler TMImporter.BatchImported, AddressOf Importer_BatchImported
TMImporter.ChunkSize = 100
TMImporter.ImportSettings.ExistingTUsUpdateMode = ImportSettings.TUUpdateMode.AddNew
TMImporter.ImportSettings.TUProcessingMode = ImportSettings.ImportTUProcessingMode.ProcessBothTUs
TMImporter.ImportSettings.ExistingFieldsUpdateMode = ImportSettings.FieldUpdateMode.Merge
TMImporter.ImportSettings.NewFields = ImportSettings.NewFieldsOption.AddToSetup
TMImporter.Import(TMXImportFile)

'building TM model and running FGA

NewFileBasedTM.BuildModel()
NewFileBasedTM.Save()
Dim MyIterator As New RegularIterator()
NewFileBasedTM.AlignTranslationUnits(unalignedOnly:=True, unalignedOrPostdatedOnly:=False, iter:=MyIterator)  <---- Here I get an exception

 

The message reads: An unhandled exception of type 'System.ServiceModelFaultException'1' occurred in SDL.LanguagePlatform.TranslationMemoryImpl.dll

Additional information: Specified method is not supported

I am out of wits - if you have an idea what I do wrong, please let me know.

 

Many thanks in advance,

Tom