4

I'm using Core Service API to find all component schemas within a folder recursively.

This is the code.

OrganizationalItemItemsFilterData filter = new OrganizationalItemItemsFilterData();
filter.Recursive = true;
filter.ItemTypes = new[] { ItemType.Schema };
filter.SchemaPurposes = new[] { SchemaPurpose.Component };
IdentifiableObjectData[] results = client.GetList(folderTcm, filter);

When I execute this code the results include all kind of schemas, not only those which purpose is Component.

I realized that if I set Recursive property to false or null it works fine but of course without finding all schemas down through folders.

I've read the API reference but I can't find any place where it's said that SchemaPurposes property can't work with Recursive property in the same filter.

What am I doing wrong?

Edit:

I'm trying to retrieve component schemas inside a specific folder recursively excluding other types of schemas like embedded schemas or metadata schemas.

1
  • 3
    I don't think you're doing anything wrong. There are limitations in which filter options can be combined (in particular for recursive queries on Folder level). IIRC, this is documented somewhere (not sure where, though). Commented Apr 6, 2017 at 17:20

2 Answers 2

5

As Rick mentioned in his comment, it might be that what your trying to achieve is not possible within a single call due to limitations of the system. If that is the case, you will have to do the recursion yourself. I suggest you try and dig up whether such limitation is mentioned in the API (.chm file).

I personally have also ran into some limitations with core service filters using recursion (unfortunately I haven't documented it for myself and I can't recall at this moment what it was). Another example, if I recall correctly is, in 2013sp1 TOM.NET combining recursion and schema name to get organizational item items does not work.

2
  • I looked for this in the .chm but didn't found anything. I don't discard it's there, I just didn't find it. So, yes, I guess you and Rick are right. I should probably implement recursion manually. Thank you very much. Commented Apr 11, 2017 at 8:22
  • Yep, I've had the same problem when trying to recursively search (through Folders) for only Multimedia Components (filter.ComponentTypes = new[] { ComponentType.Multimedia };). Commented Jan 28, 2019 at 10:49
-1

Getting all Components and Schemas in a Publication

RepositoryItemsFilterData filterData = new RepositoryItemsFilterData();
filterData.ItemTypes = new[]
    {
        ItemType.Component,
        ItemType.Schema
    };
filterData.Recursive = true;
XElement resultXml = client.GetListXml(publicationId, filterData);
1
  • I'm sorry but this is not useful. I'm not interested in retrieve all components and schemas in a publication, but component schemas (excluding other types of schemas like embedded ones) inside a specific folder instead. Commented Apr 6, 2017 at 7:17

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.