Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

We have a SharePoint 2010-portal for document collaboration, developed for one of our customers.

The require the ability for authors to be able to delete their own draft versions, but not published major versions. So that if you edit a document, and it is in version 2.3, you can delete the .3-version, but you will always leave the 2.0 version behind.

Is this possible?

share|improve this question
add comment

1 Answer

You can achieve this functionality by using an item event receiver on your list items. When the ItemDeleting event fires, you need to check the list item publishing status (Draft,Approved, pending) and delete the item if it's a drat or pending version, else give it an appropriate error.

 public override void ItemDeleting(SPItemEventProperties properties)
       {
           if (properties.ListItem.ModerationInformation.Status == SPModerationStatusType.Approved)
                properties.ErrorMessage = "You can not delete published version";
           else
               base.ItemDeleting(properties);
       }

Of course you also need to check if you are an administrator so you can delete the item even if it's approved version.

share|improve this answer
    
This has to be done prior to the user pressing the "delete"-button. So that they do not think they are allowed something they're not –  sarcophilus Jan 16 '13 at 13:40
add comment

Your Answer

 
discard

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.