I need to use the relevant event receiver to tell if a document is being published, is this possible? I will settle for has 'just been published' - i.e. I have no preference between itemupdating and itemupdated.
What I've Tried
I've tried both itemupdating and itemupdated with the following code:
private Boolean IsBeingPublished(SPItemEventProperties properties)
{
Int32 beforeVersion, afterVersion;
beforeVersion = Convert.ToInt32(properties.BeforeProperties["vti_level"]);
afterVersion = Convert.ToInt32(properties.AfterProperties["vti_level"]);
return beforeVersion == afterVersion;
}
This doesn't work, it's true most of the time so doesn't indicate whether it's been published or not.
Any help GREATLY appreciated. I need this to consistently tell me whether the event was fired because of a publish action or not.
