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

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?

thanks!

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
add comment

1 Answer

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
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.