Example Looping through Component Presentations (.NET)
If the Component Presentations on a Page are not assembled at visit time using a query, the Page contains a list of Component Presentations (a Component and a Component Template) that you will need to loop through in your Core Service code.
static void IteratingComponentPresentations(CoreServiceClient client)
{
const string pageUri = "tcm:2-372-64";
PageData page = (PageData)client.Read(pageUri, null);
Console.WriteLine("Component Presentations of Page {0} ({1})", page.Title, page.Id);
foreach (ComponentPresentationData componentPresentation in page.ComponentPresentations)
{
Console.WriteLine("Component {0} with Component Template {1}", componentPresentation.Component.IdRef, componentPresentation.ComponentTemplate.IdRef);
}
}