Web developers wiki ASP.NET Sitecore Sharepoint Kentico by Evident Interactive

Read value from PublishingPage field

Modified: 2009/02/04 13:55 by BHammendorp - Categorized as: SharePoint
If you want to get the value from a specific field in a PublishingPage item, you can use the next construction:

SPWeb rootWeb = SPContext.Current.Web.Site.OpenWeb(itemPath);
PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(rootWeb);
pages = pweb.GetPublishingPages(); 

foreach (PublishingPage page in pages)
   string fieldValue = page.ListItem"xxx" as string;
   Response.Write("Field xxx has value: " + fieldValue);

 © Evident Interactive BV