0

I want to revert back the last updated version of Document through Event Receiver on specific condition occurred.

I have 1 Document Library, in which I have assigned a content type. In content type there is a 1 field based on that, I want to remove the last saved version of document. Or you can say document update by some specific user (the username is found in the custom field), then I don't want to allow to create new version of that document.

FYI - this case occurs only when someone tries to save the document through word application.

Kindly guide me how I can achieve this.

0

You can maintain minor and major versions for document library in SharePoint. Whenever user updates the document first it will be saved as minor version. Now when user does check-in the document at that time new major version of the document will be published and be available that new major version for all other users.

For your functionality, you can use ItemCheckIn event from event receiver. So when user goes to check-in the document, event will be fired and using event receiver you can put your business logic to restore previous major version or whatever version you want.

Reference articles for event receivers

Get major version from SharePoint list item

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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