Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm pulling a list of pages from a PublishingWeb like so

...
PublishingWeb pubWeb = PublishingWeb.GetPublishingWeb(elevatedWeb);

foreach (PublishingPage page in pubWeb.GetPublishingPages())
{
    ...
}
...

By using a PublishingPage I can get the page Title, Description, CreatedDate easily but it sorts on CreatedDate ascending (I need descending, but would ultimately prefer using the default view to determine order)

Is there anyway to pull the DefaultView of the PublishingPages? I realize these are two different things since Views relate to an SPList and not a PublishingPage.

I can pull in the list instead with something like

SPList pages = web.Lists["Pages"];

foreach (SPListItem page in pages.GetItems(pages.DefaultView))
{
    ...
}

However, in this case the Title and CreatedDate fields are empty, if I dig deeper in the properties I can get to vti_title but feels like I've lost my way digging that far.

share|improve this question
1  
A tip for performance: use web.GetList("/MyWeb/Lists/Pages") instead of web.Lists["Pages"] patil-rajesh.blogspot.com/2011/04/… –  RJ Cuthbertson Nov 20 '12 at 18:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.