Tridion 2009 TBB:如何确定某个页面是否发布到特定的发布目标? [英] Tridion 2009 TBB: How do I determine if a Page is published to particular publication target?

查看:143
本文介绍了Tridion 2009 TBB:如何确定某个页面是否发布到特定的发布目标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个TBB使用TOM.NET API我想获得这些发布的网页列表 - 基本上我建立一个网站地图。我想,以确定是否Tridion.ContentManager.CommunicationManagement.Page出版。

In a TBB using the TOM.NET API I want to get a list of pages which are published - basically I'm building a sitemap. I am trying to determine if a Tridion.ContentManager.CommunicationManagement.Page is published.

似乎没有成为一个 |评论属性或 IsPublishedTo 方法。

There doesn't seem to be an IsPublished property or the IsPublishedTo method.

有一个筛选条件,我可以补充的吗?例如。

Is there a Filter condition I can add? E.g.

pageFilter.Conditions["Published"] = "true";



在回应评论:

我使用的TOM.NET API和我想要得到的这些发布的网页列表 - 基本上我建立一个网站地图

I'm using the TOM.NET API and I want to get a list of pages which are published - basically I'm building a sitemap.

这似乎是PublicationEngine.IsPublished方法返回真如果页面蓝图层次结构内的任何位置发布到给定的目标。这似乎并不像预期的行为。

It seems like the PublicationEngine.IsPublished method is returning "true" if the page is published to the given target anywhere within the BluePrint hierarchy. This doesn't seem like expected behaviour.

推荐答案

在这种情况下,如果有多个出版物的蓝图,您可以使用PublishEngine.GetPublishInfo()反对你,并检查如果你是从存在于出版物出版出版物从该方法返回的页面方式:

In this scenario where you have multiple Publications in the BluePrint, you can use the PublishEngine.GetPublishInfo() method against the page you are on and check if the Publication you are publishing from exists in the Publications returned from that method:

IList<RepositoryLocalObject> rlos = structuregroup.GetItems(pageFilter);
List<Page> pages = new List<Page>(rlos.Count);    
foreach (RepositoryLocalObject o in rlos)
{  
    Page p = (Page) o;
    bool isPublished = false;
    ICollection<PublishInfo> publishInfo = PublishEngine.GetPublishInfo(p);
    foreach (PublishInfo info in publishInfo)
    {
        if (info.Publication.Id.ItemId == p.Id.PublicationId)
        {
            isPublished = true;
        }
    }

    if(p != null && isPublished)
    {
        pages.Add(p);
    }
}

您必须认识到,有一个错误这种方法它总是返回您从发布当前出版物。这已被固定在修补程序CM_2009.1.74835。您需要申请,否则上面的代码将无法正常工作。

You have to be aware that there was a bug in this method where it will always return the current Publication that you are publishing from. This has been fixed in the Hotfix CM_2009.1.74835. You need to apply that otherwise the code above won't work correctly.

这篇关于Tridion 2009 TBB:如何确定某个页面是否发布到特定的发布目标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆