5

The TcmUri class is a handy tool, for example to grab the publication id from a component id.

string publicationId = new TcmUri(new TcmUri(componentId).PublicationId, ItemType.Publication);

How should we do this when using the CoreServiceClient DLL? Now I use this Tridion.Common dll which contains Tridion.ContentManager.TcmUri, but I feel bad about using part of the TOM.NET API in a non-TOM application.

I know we could do string maipulation to get the publication id from the component id, that would be rebuilding part of the TcmUri class.

4

In the CoreService, a TcmUri type will be generated as String by the proxy generator, so in most cases you won't need an actual TcmUri class.

There is the ICoreService2012.GetTcmUri method which is documented as returning a TcmUri, and the notes state that a String might be generated by the proxy, which indeed is the case.

That all being said, Tridion.ContentManager.TcmUri is a handy class to use, so you don't have to do String manipulation on your TCM URI when you need things like the Item ID, Publication ID or Item Type.

| improve this answer | |
6

You can safely use Tridion.Common.dll in your CoreService apps, this dll has no dependencies on the rest of Tridion and contains (among others) the TcmUri class.

| improve this answer | |
  • Thanks for confirming the Tridion.Common is designed to have no dependencies. Sounds like the most practical way forward. – Jan H Apr 2 '14 at 7:43
4

AFAIK, I don't see equivalent class for Tridion.ContentManager.TcmUri in coreservice. it has a function though, to obtain the Item URI in different Repository contexts.

string GetTcmUri(string baseUri, string contextRepositoryUri, System.Nullable<uint> version)

Also, you can write your own class for it, exposing properties accordingly using sting manipulations.

| improve this answer | |
  • For this to be a useful answer, you'll need to give more information. – Dominic Cronin Apr 1 '14 at 9:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.