Take the 2-minute tour ×
Tridion Stack Exchange is a question and answer site for Tridion developers and administrators. It's 100% free, no registration required.

I am migrating my code of Event Code system from Tridion 2009 to Tridion 2011(SDL TOM.NET), I am facing some problem while publishing page via code. My existing code which is written in Tridion 2009 is as below.

PublicationTarget targets = null;
TDSEClass class2 = new TDSEClass();
targets = class2.GetPublicationTarget(pubTargUri);
page2.Publish(targets, false, true, true, DateTime.Now.AddMinutes(-82.0), DateTime.MinValue, DateTime.Now, true, EnumPublishPriority.Normal, false, 0);

But I do not have any idea to do same thing in 2011. I had also tried to get help from the document but did not success.

Thanks.

share|improve this question
    
check the item types of the new arguments. For example, targets is an array of string URIs. Also, please post your solution code here when it is working to help devs in future. Thanks. –  robrtc Mar 11 at 9:56
add comment

3 Answers 3

up vote 2 down vote accepted

Like I told you in my previous answer and comment on your question, check out the sample code of my Rapid Editorial Interface event handler, that shows you how to Publish items using the TOM.NET API in lines 75 to 132 of RapidEditorialInterface.cs.

It basically comes down to:

// adding current item to the list of items to publish
List<IdentifiableObject> items = new List<IdentifiableObject>();
items.Add(subject);

// publish item(s)
List<TargetType> targets = new List<TargetType> { new TargetType(myTargetTypeUri, subject.Session) };
PublishInstruction publishInstruction = new PublishInstruction(subject.Session);
PublishEngine.Publish(items, publishInstruction, targets, PublishPriority.Normal);
share|improve this answer
    
Thanks Bart. it works. –  Urvesh Mar 11 at 10:51
    
this works for page, as i get the myTargetTypeURI from the page stuff, but when there is no publishing of the component, say event code on component save and close. In such a scenario how can i get the myTargetTypeURI –  Urvesh Mar 19 at 10:54
1  
@Urvesh You have to configure it somewhere, see how I do this in my Rapid Editorial Interface (I'll keep repeating that same answer till you actually take a look at it ;o). –  Bart Koopman Mar 19 at 11:08
add comment

Look up Tridion.ContentManager.Publishing.PublishEngine.Publish()

share|improve this answer
add comment

Pages, Components etc. no longer have Publish methods. Instead, you can use the static class Tridion.ContentManager.Publishing.PublishEngine and call it's Publish method, specifying any Identifiable Objects and Publication Targets or Target Types to publish to.

Download the TOM.Net programmers reference guide from the API documentation (login required) and look up the Publish method.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.