I was using Tridion 2009 and have just upgraded to 2011. We already have a event code (.net framework 3.5)implemented to track some page publish event in the method 'OnPagePublishPost' and it is working fine. I know how to get components and multimedia component attached to that component from page and then publishing that page.

I need to make the change in the event system now, and on the component save 'OnComponentSavePost' method.

Query 1. In 'ComponentSavePost' method, I want to publish the attached multimedia image component in the component.publish that image using publishbinary method.

My code sample is below:

private void BuildXMLFile(Component Component)
    Component thumbnailcomp = null;
        EventHelper.WriteEventToHTMLLog("BuildXMLFile: Start");

        string strMsgLabel = string.Empty;
        StringBuilder strXMLBody = null;

        strXMLBody.Append("<componentid>" + Component.ID + "</componentid>");
        if ((Component.Fields["title"] != null) && (Component.Fields["title"].value.Count > 0))
            strXMLBody.Append("<title>" + Component.Fields["title"].value[1].ToString() + "</title>");
            EventHelper.WriteEventToHTMLLog("Got title value of the image component");
        if ((Component.Fields["thumbnail"] != null) && (Component.Fields["thumbnail"].value.Count > 0))
            thumbnailcomp = (Component)Component.Fields["thumbnail"].value[1];               
            strXMLBody.AppendFormat("<thumbnail>{0}</thumbnail>","Images" + "/" + thumbnailcomp.Multimedia.Filename + "_" + thumbnailcomp.ID);
            EventHelper.WriteEventToHTMLLog("Got thumbnail path value of the science prize image component:" + "Images" + "/" + thumbnailcomp.Multimedia.Filename + "_" + thumbnailcomp.ID);
            //how to publish this thumbnailcomp mulitmedia item? I tried to find the publish class but there is no direct publish method
            //thumbnailcomp.Info. - 
    catch (Exception ex)
        EventLog.WriteEntry("Event_System", ex.ToString(), EventLogEntryType.Warning, 234);
        EventHelper.WriteEventToHTMLLog("BuildXMLFile: Finally");
        thumbnailcomp = null;
  • Your 2009 .NET event system is actually a TOM interop event system which is deprecated. You are better off rewriting your entire event system using the TOM.NET API which comes with 2011. Commented Jan 16, 2014 at 14:54
  • I think I get the business requirement, but does it have to be from the content linking to the binary? You could publish the component instead and have its template publish the binaries. If the idea is to put binaries on the server before the content you could instead publish the binaries when created and reduce the publishing impact. Commented Jan 17, 2014 at 15:11
  • Hi ALvin.. Yes its from content linking to binary, my aim is to generate an xml file on server on component save, so what i have planned is, i will generate a xml file on the component save from event code and attach the xml file content in the blank xml component and attach that component to the blank page of type xml to publish its content . By doing so the xml will get published on the server and it will be available for java pages at a path..Our current system uses java and vbscript for development. Event code is in .NET. Commented Jan 18, 2014 at 6:26

2 Answers 2


Query 1: I don't think you will be able to get the Publish Path in Event System. You will need to use a Template Building Block since the Publish Path is calculated during publishing.

Query 2: Tridion 2011 SP1 indeed still supports the legacy Event System however you will need to reference the Tridion 2011 Legacy interop assemblies.

  • Thanks for the replies. I also mailed the Tridion support and came to know that old event code will work on 2011. I have a slight modification in the question thinking on Eric's reply. My requirement is to publish the attached multimedia component(in my case its image) to a component on the server. How can i publish the component in OnComponentSavePost method? Commented Jan 17, 2014 at 9:13
  • Hi, I have updated my question, i just have one query? How to publish the attached multimedia component to a component from the event code's 'OnComponentSavePost' method. Commented Jan 17, 2014 at 10:57

Am not going into the merits of your requirements and implementation. But just answering your query.

You can't call PublishBinary method within Event System. You may do the following.

  • Create a dynamic CT which has the multimedia schema in allowed schema list

  • Call the PublishBinary Method in CT code

  • Within the Event System, call the method {MultiMediaComponentObject}.Publish. This will result in Multimedia Component to be added to the publishing queue.

  • Multimedia Component will be rendered by the CT created. This will publish the binary.

  • Thanks premkumar. As i am not a very professional tridion developer,I am unable to relate the areas where the code would be needed, i work in vbscript and we have a team of java guys. Our event code is in .NET. I have mentioned what i want to achieve in alvin's reply. So i am not sure where will I create Dynamic CT. Commented Jan 18, 2014 at 6:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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