2

I have a requirement to trigger mail to the targeted audience on Component Publish event.I am planing to handle this requirement using Event System. But I am unable to figure out event available like PublishEventArgs.

Here is the code I have tried -

 public void Subscribe()
    {

        EventSystem.Subscribe<Component, PublishEventArgs>(SetOrUpdateComponent, EventPhases.Processed);
    }

But my application is not able to recognize the PublishEventArgs as an Event. I am getting an error -

The type or namespace name 'PublishEventArgs' could not be found (are you missing a using directive or an assembly reference?)

I have already included below assemblies -

using Tridion.ContentManager;
using Tridion.ContentManager.ContentManagement;
using Tridion.ContentManager.CommunicationManagement;
using Tridion.ContentManager.ContentManagement.Fields;
using Tridion.ContentManager.Extensibility;
using Tridion.ContentManager.Extensibility.Events;

Please suggest if I have missed any assembly.

enter image description here

  • 1
    This is a little vague. Could you clarify what you have tried and what the issues were? Preferably with the code for what you have tried. Also, are you Components dynamic and will be published on their own? Or will they be on a Page that is then published? Both? – Peter Kjaer Dec 30 '15 at 10:17
  • Hi Peter, I have tried below method public void Subscribe() { EventSystem.Subscribe<Component, PublishEventArgs>(SetOrUpdateComponent, EventPhases.Processed); } But my application is unable to recognize PublishEventArgs. – Sayantan Basu Dec 30 '15 at 10:20
  • 1
    Please edit your original post and add these details. Basically, consider that PublishEventArgs is the correct event -- now what? – Peter Kjaer Dec 30 '15 at 10:22
  • 1
    What do you mean by "But my application is not able to recognize the PublishEventArgs as an Event."? Do you get a compilation error? Does it not fire the event? Have you tried debugging and, if so, is your breakpoint getting hit? Is your publisher outscaled to a different machine? – Peter Kjaer Dec 30 '15 at 10:25
  • I have updated the error details in my question. I am getting a compilation error - The type or namespace name 'PublishEventArgs' could not be found (are you missing a using directive or an assembly reference?) – Sayantan Basu Dec 30 '15 at 10:34
3

You can find a list of all Events for Tridion 2013 on link:

More detailed explanation of events is possible to find in "SDL Tridion 2013 SP1 TOM.NET API.chm" API document from SDL. There is some documentation about events on SDL Live Content:

There is a lot of blogs out there on how to work with event system, as this is one part of Tridion with good coverage. (For example this blog explains how to work with Tridion Event System)

Definitely use event OnComponentPublish (name used in old event api you can find the new api in above event matrix document). Depending on requirements when you need to send the email you can choose between two phases Initiate or Processed. You probably need Processed phase...

EDITED: You are probably missing

using Tridion.ContentManager.Publishing;
  • Thanks for the Information. I have added that assembly as well and tested . The error is still there. – Sayantan Basu Dec 30 '15 at 10:45
  • I have removed that dll and imported it again and now it is working properly. Thanks for your help. – Sayantan Basu Dec 30 '15 at 12:09
4

The type or namespace name 'PublishEventArgs' could not be found (are you missing a using directive or an assembly reference?)

I have already included below assemblies -

...

using Tridion.ContentManager.Extensibility.Events;

Since you have already added the correct using directive, the other part of the error message must be true: you haven't added "Tridion.ContentManager.Publishing.dll" as a reference in your project. Note that using directives and assembly references are two very different things.

  • Hi Peter, I have already added ContentManager.dll in to my application. – Sayantan Basu Dec 30 '15 at 11:48
  • When I am using SaveEventArgs or CheckInEventArgs, it is working fine but only giving issue when using PublishEventArgs. – Sayantan Basu Dec 30 '15 at 11:57
  • PublishEventArgs is actually in Tridion.ContentManager.Publishing.dll, whereas SaveEventArgs and CheckInEventArgs are in Tridion.ContentManager.dll – Peter Kjaer Dec 30 '15 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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