Publish a Major Version – events

Publish a Major Version: this menu is only available when file is in a checked-in status. If it’s already checked out, it can only be checked in. When action is taken, ItemCheckedIn event is not called. Instead, ItemUpdated is called. However, both BeforeProperties.ChangedProperties and AfterProperties.ChangedProperties contains zero information so you can’t tell from ItemUpdated event if this is a “publish” action.

The version # will be automatically bumped to next major version #.

Unpublish this version: same as above, it’s also only available for checked-in status. The version # will be rolled back and ItemUpdated event will be called. ItemCheckedIn is not called (obviously).

If one want to handle these 2 menu actions, seems ItemUpdated event is the only entrance. However many other actions will also trigger ItemUpdated event.

If you want to remove these 2 menus,  edit core.js under \12\TEMPLATE\LAYOUTS\1033\ folder.  I commented out a section in AddCheckinCheckoutMenuItem function to hide the Unpublish menu. I did that because for unknown reason it would cause “Access Denied” error when someone does that after we customized the security.

Advertisements
This entry was posted in Events and tagged , , . Bookmark the permalink.

5 Responses to Publish a Major Version – events

  1. Merlin says:

    Hy,

    I have a problem with the unpublish option in the interface of SharePoint.

    When I click it, SharePoint tell me that I do not have right !
    The problem is I am using the system account !

    any idea ?

    Merlin

  2. calvin998 says:

    Actually I’m having the same problem. After I enabled the approval requirement at Doc Lib, it happens. But if I disable the approve, unpublish works. I’m still trying to find out the reason. The user I used to test is part of the owner group and has full access to doc lib, and it also one of the site collection admin.

  3. Mano says:

    modifying the core.js file is not a good practice.

    Instead add a new custom js file in the same directory, and override the function specific to your target operation.
    Now, reference this custom js file in the master page after the core.js reference using the SharePoint:Scriptlink tag and set the defer=true.

    this will do the trick

  4. Printing says:

    Thanks for this article I really liked it. Thumbs up 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s