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
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();
-
Could you please tell me how to get that 'Where used' list's publication names?– BhavyaCommented Mar 9, 2016 at 11:29
-
-
It is throwing an error for me like "LocationInfo" cannot be resolved or is not a field. Its the same with "item"– BhavyaCommented 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.– BhavyaCommented Mar 10, 2016 at 4:48
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 !!