是否可以在SDL Tridion 2011中使用Tom.net API发布页面?
答案 0 :(得分:2)
正如Nuno所说,使用PublishEngine.Publish
并参考语法和示例
PublishEngine.Publish(
new IdentifiableObject[] { linkedComponent },
engine.PublishingContext.PublishInstruction,
new List() { engine.PublishingContext.PublicationTarget });
做这样的事情: -
private void Publish(IdentifiableObject item, PublicationTarget publicationTarget, bool rollBackOnFailure, bool includeComponentLinks)
{
IEnumerable<IdentifiableObject> items = new List<IdentifiableObject>() { item };
IEnumerable<PublicationTarget> targets = new List<PublicationTarget>() { publicationTarget };
PublishInstruction instruction = new PublishInstruction(item.Session)
{
DeployAt = DateTime.Now,
RenderInstruction = new RenderInstruction(item.Session)
{
RenderMode = RenderMode.Publish
},
ResolveInstruction = new ResolveInstruction(item.Session)
{
IncludeComponentLinks = includeComponentLinks
},
RollbackOnFailure = rollBackOnFailure,
StartAt = DateTime.MinValue
};
PublishEngine.Publish(items, instruction, targets);
}
**内容是从 How to Publish Stuff Programmatically 博客
复制的答案 1 :(得分:1)
使用PublishEngine.Publish
,从那里关注Intellisense。您需要提供渲染和解析说明,以及目标,开始日期/时间等常用细节。
文档包含示例,各种博客都有示例,Visual Studio应该可以帮助您找到所需内容。