I am beginning to suspect something has changed in the API. The error seems to be coming from this component:
Sdl.Desktop.Platform.ServerConnectionPlugin.TMServer.TranslationMemoryAdminstrationClientFactory.Create(String baseAddress, UserCredentials credentials, IServerConnectionService serverConnectionService)
In Studio 2022, I could connect to our TM Server in GroupShare with this code.
I used the Windows credentials of the current user without having to ask the user to enter them:
private void button1_Click(object sender, EventArgs e) { bool blWindowsAuthentication; blWindowsAuthentication = true;
// Connect with URL and credentials // TranslationProviderServer tmServer = new TranslationProviderServer(GetUri(txtServerURI.Text), blWindowsAuthentication, "", ""); TranslationProviderServer tmServer = new TranslationProviderServer(GetUri("">https://SERVERNAME"), blWindowsAuthentication, userName: null, password: null); MessageBox.Show ("Connected"); }
private Uri GetUri(string _serverUri) { return new Uri(_serverUri); }
Now exactly the same code gives this error:System.NullReferenceException: 'Object reference not set to an instance of an object.'
Here is the stack trace with more details:
Source: Sdl.Desktop.Platform.ServerConnectionPluginStackTrace " at Sdl.Desktop.Platform.ServerConnectionPlugin.TMServer.InternalClients.TmServiceRestClientCreator.CreateRestClient(String baseAddress, ClientSettings clientSettings)at Sdl.Desktop.Platform.ServerConnectionPlugin.TMServer.InternalClients.InternalRestClient..ctor(String baseAddress, ITmServiceRestClientCreator restClientCreator, IBcmToTransUnitConverter bcmToTransUnitConverter)at Sdl.Desktop.Platform.ServerConnectionPlugin.TMServer.TranslationMemoryAdminstrationClientFactory.Create(String baseAddress, UserCredentials credentials, IServerConnectionService serverConnectionService)at Sdl.LanguagePlatform.TranslationMemoryApi.TranslationProviderServer..ctor(Uri serverUri, Boolean useWindowsAuthentication, String userName, String password)\at WindowsFormsApp1.Form1.button1_Click(Object sender, EventArgs e)According to the SDK, this should work:
https://developers.rws.com/studio-api-docs/api/translationmemory/Sdl.LanguagePlatform.TranslationMemoryApi.TranslationProviderServer.html
useWindowsAuthentication
Whether to use Windows authentication. When n set to false, userName and password have to be specified. When set to true , either pass null for userName and password in order to log on as the currently logged on Windows user, or set userName to a domain-qualified Windows user name and password to the matching password to log on using basic Windows authentication.
Thanks!
Daniel
Translate