Tridion Stack Exchange is a question and answer site for Tridion developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 4 down vote accepted

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.

share|improve this answer

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.

share|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

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.

share|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 posting your answer, you agree to the privacy policy and terms of service.

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