14

I wish to retrieve a list of all schemas for a given publication - including inherited ones.

Originally I was using the getSearchResults core service method with a filter constraining to the current publication and a search type of ItemType.SCHEMA. However, this only returns schemas that are defined in the supplied publication - ignoring any inherited schemas. Removing the publication filter means I end up with all schemas in any publication.

So instead, I've started looking at the getList core service method, passing in a BluePrintChainFilterData filter with the direction set to BluePrintChainDirection.UP. However, this isn't returning what is expected.

Any ideas?

2
  • Turns out my original technique would also have worked. However it's good to know there are alternative ways of achieving the same result. I'm now wondering which is the more efficient? getList or getSearchResults? Thanks, Ben
    – Bengineer
    Mar 15, 2013 at 13:34
  • 2
    GetList uses a DB Stored Procedure + a few abstraction layers and is an internal call, GetSearchResults uses the SOLR search engine, and relies on it being accurate. I would use the GetList method simply because it must work always, while the Search may not give you the correct results if the search index is not maintained properly.
    – Nuno Linhares
    Mar 15, 2013 at 14:40

1 Answer 1

17

You need to use RepositoryItemsFilterData:

var filter = new RepositoryItemsFilterData();
filter.ItemTypes = new[] {ItemType.Schema, };
filter.Recursive = true;
var schemasXml = ClientAdmin.GetListXml("tcm:0-2-1", filter);

You can also use OrganizationalItemItemsFilterData in the similar way, but on the BuildingBlocks level

0

Your Answer

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

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