Is it possible to publish a Page by using Tom.net API in SDL Tridion 2011?
Asked
Active
Viewed 597 times
-6
-
1Yes. Care to tell us what you tried? – Nuno Linhares Dec 04 '12 at 13:51
-
@NunoLinhares: i want to write an event where whenever a page is deleted or created, a sitemap page gets published. – user1573378 Dec 04 '12 at 13:56
-
Cool. Google is your friend: http://codedweapon.com/2012/03/tridion-publishengine/ – Nuno Linhares Dec 04 '12 at 13:58
-
@NunoLinhares:: thanks , But this page does not explain how to publish a page using TOM.net. – user1573378 Dec 04 '12 at 14:05
2 Answers
2
As Nuno mentioned, use PublishEngine.Publish
and refer the syntax and example
Syntax:
PublishEngine.Publish(
new IdentifiableObject[] { linkedComponent },
engine.PublishingContext.PublishInstruction,
new List() { engine.PublishingContext.PublicationTarget });
Do something like this:-
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);
}
**Contents is copied from How to Publish Stuff Programmatically blog

Siva Charan
- 17,940
- 9
- 60
- 95
1
Use PublishEngine.Publish
, follow Intellisense from there. You'll need to provide Render and Resolve instructions, as well as the usual details like Target, start date/time, etc.
The documentation has samples, various blogs have samples, and Visual Studio should help you find what you need.

Nuno Linhares
- 10,214
- 1
- 22
- 42
-
1Sorry if I'm being rough, but this is a really simple task. Lesson #1: Tridion Content Manager Explorer uses the same API that you do, if it can do something, then you can do it too. – Nuno Linhares Dec 04 '12 at 14:35