SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an EventReceiver associated to DocLib template id, triggered at every ItemUpdate. Everytime an SPListItem is publish I want to execute my code.

(Required check out and Content approval are turned off)

So, is the type ItemUpdated the best one in this case? What the best way to check if item was publish?


share|improve this question
Why not check properties.ListItem.Level == SPFileLevel.Published? – Colin Jan 22 '14 at 17:28
It won't work for the case when file is checked out. Level in this case will show CheckedOut state. – sleepwalker Oct 22 '15 at 17:05
up vote 2 down vote accepted

In ItemUpdated check

properties.ListItem.File.MinorVersion == 0
share|improve this answer
-.- oh god..... – fallout Apr 3 '12 at 13:42
This is Sharepoint :D – fr34kyn01535 Aug 22 '12 at 6:52
@per - am I right in assuming this isn't a way to tell whether the event was fired because it has been published? I need a way of testing the beforeproperties against the afterproperties to monitor changes to whether the document is published or not (i.e. need an event to fire on publishing) but cannot find the appropriate field name. – JᴀʏMᴇᴇ Dec 10 '12 at 14:55
I'd extend this a bit. If file is checked out by current user and this user tries to check using this one - it will be needed compare with 1. For other users - check with 0 will work just fine. – sleepwalker Oct 22 '15 at 17:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.