2

I want to get the schema's where used list of page templates, schemas etc.,provided with schema ID? Please help on this?

2 Answers 2

8

CoreService:

 var list = ClientAdmin.GetList("tcm:1-1-8", new UsingItemsFilterData());
 var listXml = ClientAdmin.GetListXml("tcm:1-1-8", new UsingItemsFilterData());

Tom.NET:

schema.GetListUsingItems();
6
  • Could you please tell me how to get that 'Where used' list's publication names?
    – Bhavya
    Commented Mar 9, 2016 at 11:29
  • I have updated my answer Commented Mar 9, 2016 at 11:55
  • It is throwing an error for me like "LocationInfo" cannot be resolved or is not a field. Its the same with "item"
    – Bhavya
    Commented Mar 9, 2016 at 12:13
  • That is probably because your list is empty. Can you first check this? Commented Mar 9, 2016 at 14:18
  • No my list is not empty. I am able to read all the where used values.
    – Bhavya
    Commented Mar 10, 2016 at 4:48
3

For this scenario, you can try the following using core service as there is no built in methods for this:

    UsingItemsFilterData filterCriteria = new UsingItemsFilterData();
    filterCriteria.BaseColumns = ListBaseColumns.Id;
    filterCriteria.IncludeLocalCopies = true;
    var resultList =CoreServiceClient.GetList("SchemaURI", filterCriteria);

If you don't want to use or have core service the same can be achieved using TOM.Net API, there is a method on IdentifiableObject called HasUsingItems() which will give you the details also. Check this link once !!

You can have a look in this link which will give you ideas on how to use core service more effectively for similar kind of scenarios.

Let me know if this helps !!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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