简体   繁体   中英

How to determine if a Publishing Page in Sharepoint 2007 is actually published

Within a web part code I have got to transform a sharepoint website in a pdf document, I have completed this. There is an extention that needs to be done, where the PDF document is to only get the published pages.

So I have a list of pages using the "siteMapnodeCollection" and getting the child nodes etc, how do I check that the publishing page represented by a node is actually published & approved?

Thanks

Marc

See:

  • Microsoft.SharePoint.Publishing.PublishingPage.IsPublishingPage(listItem)
  • Microsoft.SharePoint.Publishing.PublishingPage.GetPublishingPage(listItem)

and:

  • (pageinstance).ListItem.File.Level (should be "Published")
  • (pageinstance).ListItem.ModerationInformation.Status (should be "Approved")

update:

Most publishing webs are configured to use moderation, but yours may not so you might not have to check for approval.


PublishingPageCollection pages = PublishingWeb.GetPublishingWeb(web).GetPublishingPages();
foreach (PublishingPage page in pages)
{
    if(!page.ListItem.File.Level == SPFileLevel.Published)
       return;
// logic }

You can also pass a CAML Query in the GetPublishingPages() method, bringing the items under the correct status.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM