Gus*_*itt 4 tridion tridion2009
我正在尝试捕获未发布组件的时间.我尝试了一些方法,但我没有想要的结果.我的尝试是:
在事件系统中.但这不起作用,因为Windows中有一个关于MSXML和COM +的已知错误.
我尝试构建自己的IResolver但在那里我无法确定它是否是发布或取消发布操作.
我尝试构建自己的ITransportPackageHandler.在那里,我有一个名为HandleResolvedItemForUnPublishing的函数,但是我没有关于PublicationTarget的任何信息,我不知道它是否从staging或live中取消发布.
有人能帮我吗?我认为如果以下情况我可以解决问题:
非常感谢你.
古斯塔沃.
你应该能够看ResolvePurpose的ResolveInstruction是你的自定义解析器的参数之一.这些方面的东西:
public void Resolve(IdentifiableObject item, ResolveInstruction instruction, PublishContext context, ISet<ResolvedItem> resolvedItems)
{
if (instruction.Purpose == ResolvePurpose.Publish || instruction.Purpose == ResolvePurpose.RePublish)
{
// We are publishing
}
else if(instruction.Purpose == ResolvePurpose.UnPublish)
{
// We are unpublishing
}
// Don't know if this one exists in 2009, it exists in 2011 SP1
else if(instruction.Purpose == ResolvePurpose.UnknownByClient)
{
// The server is doing something that I don't understand (yet?)
}
}
Run Code Online (Sandbox Code Playgroud)
编辑
我拒绝找到办法让这项工作......
实际上,在Tridion 2009中,您没有Purpose解决方案.您Action在发布事务中确实有一个,但是这个没有直接在解析器中公开.以下是我发现或发布的方式 - 如果认为它是过度杀戮你的电话,但我的非生产VM的性能非常好.
Action属性确定操作Filter filter = new Filter();
filter.Conditions["InfoType"] = 2; // Get transactions in Progress
foreach (XmlNode node in item.Session.GetList(typeof(PublishTransaction), filter))
{
if(node.Attributes["ItemID"].Value.Equals(item.Id.ToString()))
{
// we have a winner
string action;
if (node.Attributes["Action"].Value.Equals("0"))
action = "Publish";
if (node.Attributes["Action"].Value.Equals("1"))
action = "Unpublish";
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
180 次 |
| 最近记录: |