2

If I've tcmUri say(tcm:31-2-1) how can I know the nature of it. Whether it is Component,Page,Schema,Folder etc. Do we have anything in core services by which we can check>

2 Answers 2

2

I always use this TcmUri class: https://gist.github.com/quirijnslings/d9ff8a421f9087b4b24f8b8942de6675.

You can use it like this:

var uri = new TcmUri("tcm:0-23-1");
var itemType = uri.ItemTypeId;
1
  • 1
    Thanks that works for me !!!
    – Sneh Gour
    Jun 14 at 5:44
0

You can just look at it and see.

Tcm Uri is constructed of publication id, item id, and item type. In your case:

  • 0 is the publication id where your item is.
  • 23 is the item id
  • 1 is item type which is publication type.

So, you can just get that last number and find it in the core service ItemType enum:

enter image description here

Also, make note that components are specific, meaning that they don't need to have 16 added, so you need to check that one also. My case, just split that string into sections. Check for the last section that is item type and compare

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.