We have seen how to retrieve specific postings using the classes in the Microsoft.ContentManagement.Publishing
namespace. To get at the content stored within a posting, we need to use another namespace, Microsoft.ContentManagement.Extensions.Placeholders
.
In Chapter 7, we added placeholders to the PlantCatalog template. We created plant fact sheets based on the Plant template and stored content within its placeholders. Now, let's use the PAPI to read and display the stored content. The available placeholders found in each plant fact sheet are:
ResearchPaper
(AttachmentPlaceholder
)Description
(HtmlPlaceholder
)PlantPicture
(ImagePlaceholder
)
In order to access the placeholder content, we first create a drop-down list containing a list of all our postings. When the Get Fact Sheet Content
button is clicked, we retrieve the contents of the placeholders of the selected posting. This is an interesting example because it shows you how to iterate through a collection of...