Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do I use ClassifiedItemsFilterData for folders in Tridion 2011 CoreService?

I'm rewriting a .NET backend application so that it uses the Tridion 2011 CoreService. There's one part where it will get a folder in Tridion that uses a particular keyword. In the current setup, this is done by calling the method 'GetListClassifiedItems' on the keyword itself, but how am I suppose to do this using the CoreService?

There is a ClassifiedItemsFilterData available in the CoreService API, but how do I use it?

I've tried this piece of code:

ClassifiedItemsFilterData filter = new ClassifiedItemsFilterData()
{
    ItemTypes = new ItemType[] { ItemType.Folder }
};

XElement list = client.GetListXml("tcm:113-363331-1024", filter);

but it will only return the keyword itself, with URI tcm:113-363331-1024, and not the folders that have been classified with it.

If I add the component ItemType to the filter too, I will get all components that have been classified with this keywordk, but still not that folder.

How do I get the folder too?

like image 689
Reinder Wit Avatar asked Jul 23 '12 10:07

Reinder Wit


1 Answers

When I run a similar test, I do get both Folders and Components in my result

var filter = new ClassifiedItemsFilterData();
filter.ItemTypes = new ItemType[] {ItemType.Folder};
var transactions = client.GetListXml("tcm:1-134-1024", filter);
Console.WriteLine(transactions.ToString());

I added a Keyword field to a Metadata Schema and associate that with the Folder. Is that the same way you did it?

When I remove the item types filter from the code above, I get all Components and Folders classified against that Keyword, but I do not get the Keyword itself. These are all exactly how I'd expect a ClassifiedItemsFilterData to work, so we really should focus on what is different in your scenario.

like image 156
Frank van Puffelen Avatar answered Oct 12 '22 10:10

Frank van Puffelen