Add Server Based Memory to Project using API

I'm trying to add a server Based Memory to a File based Project.

I'm able to do it through the Studio UI.

But I can't figure it out with the API.

My code:

Uri projectServer = new Uri(serverUri);
project.Credentials.AddCredential(projectServer, "type=WindowsUser");


tmConfig.Entries.Add
(
new TranslationProviderCascadeEntry
(
new TranslationProviderReference(tmInfoEntry.FileName),
true,
true,
true,
0
)
);
}

project.UpdateTranslationProviderConfiguration(tmConfig);

If fileName is like {serverUri}/{Path}/{NameTM}, studio adds it but doesn't recognize the tm and I get unknown tm and tooltip saying translation provider not installed even though I use the same translation provider for file based memories

If fileName is like sdltm.{serverUri}/?=orgPath{Path}&tmName={NameTM}, I get invalid URI.

I followed the example on trados-studio-api-samples/ProjectCreator.cs at 1d593eeaf2e9dde1882c9d473dc79fc43db01310 · RWS/trados-studio-api-samples (github.com)

But what kind of URI should it be?