I'm trying to do implement some logic while a particular template item is getting published. To implement this logic I started exploring the Sitecore Powershell's Event Handlers. For the events like item:added
, item:copied
events I'm successfully able to get the output for the events, but for the Publish event like publish:begin
, publish:end
I'm not able to get any output from the result.
Below are the steps which I've followed to enable Sitecore Powershell events.
- Created the Patch file for Spe.Event.config
<sitecore role:require="Standalone or ContentManagement" security:require="Sitecore">
<events>
<event name="publish:begin">
<handler type="Spe.Integrations.Tasks.ScriptedItemEventHandler, Spe" method="OnEvent" />
</event>
<event name="publish:end">
<handler type="Spe.Integrations.Tasks.ScriptedItemEventHandler, Spe" method="OnEvent" />
</event>
<event name="item:added">
<handler type="Spe.Integrations.Tasks.ScriptedItemEventHandler, Spe" method="OnEvent" />
</event>
<event name="user:created">
<handler type="Spe.Integrations.Tasks.ScriptedItemEventHandler, Spe" method="OnEvent" />
</event>
<event name="publish:startPublishing">
<handler type="Spe.Integrations.Tasks.ScriptedItemEventHandler, Spe" method="OnEvent" />
</event>
</events>
</sitecore>
</configuration>
- Then I've created a module by following these steps, created Event Handlers with the help of this article
- When I tried for the first time it was not successful and found out the solution here but when I try the same for Publish events it's not working
Can some please assist me to figure out what mistake is being done here. Thanks in advance.