开发者

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 n开发者_运维百科eeds 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜