Reputation: 17883
I am creating a page through the core service. I want to add component presentations to it.
I have created the page like this:
var page = new Tridion.ContentManager.CoreService.Client.PageData
{
Title = "pagecore",
FileName = "pagecore",
Id = "tcm:0-0-0",
LocationInfo = new LocationInfo
{
OrganizationalItem = new LinkToOrganizationalItemData { IdRef = "tcm:9-44-4" }
},
IsPageTemplateInherited= false,
PageTemplate=new LinkToPageTemplateData { IdRef = "tcm:9-545-128" },
}
I am unable to add component presentations to it.
Can any one tell me how to add the component presentations?
Thank you.
Upvotes: 3
Views: 770
Reputation: 13483
You need to set collection of ComponentPresentationData
objects to ComponentPresentations
property of PageData
, like this:
ComponentPresentations = new[]
{
new ComponentPresentationData
{
Component = new LinkToComponentData{ IdRef = "tcm:9-16"},
ComponentTemplate = new LinkToComponentTemplateData{ IdRef = "tcm:9-20-32"}
},
}
Upvotes: 8