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 realized a minor flaw in my event receivers for a List with versioning enabled. I used the ListItem.Update() instead of ListItem.SystemUpdate(). In addition I did not use This.EventFire = false. The end result is a lot of ListItem version cleanup needed. I believe I currently have two options for removing the duplicated versions: -a: Create a console/windows app using the client object model to parse each listitem, notice a pattern for the invalid versions, and delete them programmatically. -b: Create a hidden page with a visual webpart using the server object model to do the same type of logic.

What would be the best practice for deleting the uneeded versions that are causing the list details to take forever to load?


share|improve this question
Does anyone know how to programmatically determine if any non-system fields have changed between versions? I realize that I could iterate through the fields between each version and if I see a change occurs, but this seems very expensive to do. When you click on version history for a listitem, you get a nice summary of changes between versions. Is this code/SQL accessible to the developer? – JR_ATLDev Aug 30 '11 at 19:28
up vote 3 down vote accepted

If you like the console/windows idea, you don't have to be limited to the client OM. You can create one using the server OM, you just have to run the console/windows app on one of the sharepoint servers. I personally would go with the console app using the server om route for this type of maintenance.

If you feel like you would need to run this a lot or on a regular basis, maybe a webservice or sp timer job would be more appropriate.

share|improve this answer
This should only need to be run once, assuming the list receiver logic has been fixed prior to this. – Dave Wise Aug 30 '11 at 15:52
Ok, then I think the console app with server OM is what I would do. – Steve Lineberry Aug 30 '11 at 15:58

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.