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.
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:
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:
As usual, you can check and download the code (and the CRM solution) from GitHub.