How can you identify a "Publish a Major Version" with other events? I did some googling and experiments and found out that using BeforeProperties and AfterProperties in the ItemUpdating handler might do the job. Similar posts can be found here, but I didn't get the same result.
int iBefore, iAfter;
iBefore = int.Parse(properties.BeforePropeties["vti_level"]);
iAfter = int.Parse(properties.AfterPropeties["vti_level"]);
Using the value of iBefore and iAfter I was able to identify the following events:
Event | iBefore | iAfter |
CheckIn Minor Version | 255 | 255 |
CheckIn Major Version | 255 | 1 |
Publish a Major Version | 2 | 2 |
So if (iBefore == iAfter) you a facing a "Publish a Major Version" event.
4 comments:
You saved my day. Thanks
hmm this doesnt quite work fully..updating the title on an item triggers a 'major publish'!
Bruce - this might depend on the version control settings and publishing settings.
--------------
So if (iBefore == iAfter) you a facing a "Publish a Major Version" event.
--------------
Or it could be an minor version check-in. Publishing would be "iBefore == iAfter == 2" going by your table.
Very useful analysis, I have just put it to use here.
Post a Comment