如何使用TOM.net api发布页面?

时间:2012-12-04 13:49:18

标签: tridion tridion-2011

是否可以在SDL Tridion 2011中使用Tom.net API发布页面?

2 个答案:

答案 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应该可以帮助您找到所需内容。