This code works to get content from the broker for all components whos name begins with "MC":
Criteria c1 = new ItemTitleCriteria("MC%", Criteria.Like);
//Create query
Query myQuery = new Query(c1);
String[] itemURIs = myQuery.ExecuteQuery();
ComponentPresentationAssembler cpAssembler = new ComponentPresentationAssembler();
foreach (string componentUri in itemURIs)
{
String content = cpAssembler.GetContent(componentUri, componentTemplateUri);
}
However, I am struggling to find in the api where I can actually access the names (or titles) of each component returned.
I'm not sure if the broker API has such capabilities to retrieve those attributes. You may probably need to use another library to retrieve information from the CMS.
But to answer your question, one way to get the
title
if to publish it to the brokerDB as part of thecontent
(cpAssembler.GetContent()
). Just make sure that you renderComponent.Title
in the component template. Once it's in the DB, you can parse it.Sample
content
:Note: Tridion has its own StackExchange site now, you may get more interaction there. https://tridion.stackexchange.com/