This project has moved and is read-only. For the latest updates, please go here.

Updating a Version Collection

May 1, 2012 at 7:15 PM

I am creating a version history page in SharePoint 2007 I have all of the information I need and I am able to load it into a dropdown table and display all version history for every list item on one page.  Pretty Cool!  My problem is the GetVersionColleciton operation does not seem to catch a version change when a field is deleted.  Lets say I have a name and I change it, I will get two versions.  One for the creation, and one for the change.  Now if I delete the name, I will not get a version change.  Is there any way to insert a value into the version history?  If I can do that I think my problem is solved I just cannot figure out how to do it.  I would post some code samples in here; however it is ALOT and I cannot copy and paste into here for some reason....Thanks!

May 3, 2012 at 4:06 AM

I'm not sure I follow where the problem is coming from. Any change ought to create a new version, assuming that versioning is set up.


May 3, 2012 at 2:58 PM
Edited May 3, 2012 at 3:03 PM

It should, but it does not when you delete a field value, only when one is changed and there is no undefined field.  I figured out a way around this problem using some fields to insert values into my arrays anytime something comes back as undefined. 

Build you a test using the GetVersionCollection operation.  Put something into a field, take it out, then put sommething else.  It will only have the data which was entered and no version for it being removed.

If you look in the XML printout for the xData you will see what I am talking about.  Maybe it is a bug that needs to be fixed. 

Thanks for the reply!

May 5, 2012 at 7:24 PM

You're writing the changed value into the list and the getting the version collection again, right?


May 6, 2012 at 2:02 AM

Right, everything I am running happens at run time, so everytime the page is reloaded or refreshed it gets the version history.  The issue is not getting a changed value.  It will show if I change something in the list just fine.  The problem is when I remove the value in a list item and leave it undefined.  The version does not seem to pick up this change.  It will only show the changes where the field is not undefined.  I am not sure if this is the way the operation is supposed to work; however it has caused some frustration in build a proper table with the version changes.  I can have four changes with one being a removal of the information in the list.  I will only get back three items in my xData.response because it does not pick up the removal of the list items value.  I know the value of the list item will be returned undefined, but it is still a change in the list.