gpt4 book ai didi

c# - Tridion 2009 待定 : How do I determine if a Page is published to particular publication target?

转载 作者:太空狗 更新时间:2023-10-30 00:05:39 25 4
gpt4 key购买 nike

在使用 TOM.NET API 的 TBB 中,我想获取已发布页面的列表 - 基本上我正在构建站点地图。我正在尝试确定 Tridion.ContentManager.CommunicationManagement.Page 是否已发布。

似乎没有 IsPublished 属性或 IsPublishedTo 方法。

我可以添加过滤条件吗?例如。

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

回应评论:

我正在使用 TOM.NET API,我想获取已发布页面的列表 - 基本上我正在构建站点地图。

如果页面发布到 BluePrint 层次结构中任何位置的给定目标,PublicationEngine.IsPublished 方法似乎返回“true”。这似乎不是预期的行为。

最佳答案

在这种情况下,您在 BluePrint 中有多个 Publications,您可以对您所在的页面使用 PublishEngine.GetPublishInfo() 方法,并检查您要发布的 Publication 是否存在于从该方法返回的 Publications 中:

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 中修复。您需要应用它,否则上面的代码将无法正常工作。

关于c# - Tridion 2009 待定 : How do I determine if a Page is published to particular publication target?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9772321/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com