Audit Publish & PublishAll messages

Based on a question that I found in Stack Overflow I did a little test to see how to audit Publish & PublishAll messages work and and to discover what information is available to log them using a plugin.

This post was originally published in Comunidad 365 on September 30, 2016.

Requests involved

The first step was to find out what are the requests involved and what properties exist to log the changes that are being published. After some research in MSDN, it’s pretty clear that there are two requests involved: PublishXmlRequest and PublishAllXmlRequest.

In the first request, it’s possible to get a list of all the components being published using the ParameterXml property, but in the PublishAll event this property is not there so it’s not possible to know which components are involved (actually we know that all resources are being published but there’s no detail).


With this in mind, I wrote a really simple plugin to log these events:

Once the plugin is registered in CRM, it’s necessary to create the following steps:

Publish stepPublishAll step

Testing plugin

As you can see in the code, when the plugin is executed it will create a record of a custom log entity that I’ve created:
Publish Log

As usual, you can check and download the code (and the CRM solution) from GitHub.

Federico Jousset Written by:

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *