UpdateListItems & empty dates

Mar 14, 2011 at 11:53 PM


I have a simple valuepair update of 2 date fields.  These are not mandatory fields.  Is there a way of entering an empty date?

I get the following when the fields are empty <ErrorCode>0x8102001c</ErrorCode><ErrorText>Invalid date/time value. A date/time field contains invalid data. Please check the value and try again.</ErrorText>. 

I tried http://blog-sharepoint.blogspot.com/2009/07/infopath-caml-date-time-format-in-when.html without success.

The update is successful when dates are present.


Mar 15, 2011 at 12:36 AM

Would it make sense to just not update the date(s) if they are blank? In other words, build your update conditionally based on the date column values.


Mar 15, 2011 at 12:43 AM

That would work but there maybe a case where the date needs to be reset to blank.  eg The a date is entered then a customer changes their mind and the job is put on hold till they commit to a new date.


Mar 15, 2011 at 1:35 AM
Edited Mar 15, 2011 at 1:44 AM

I just wrote trhis code and tested it and it worked fine, so you should be able to supply a blank value for the date and have it update successfully.

      operation: "UpdateListItems",
      async: false,
      listName: "States",
      updates: "<Batch OnError='Continue' PreCalc='TRUE'>" +
                "<Method ID='1' Cmd='Update'>" +
                    "<Field Name='ID'>237</Field>" +
                    "<Field Name='JoinedUnion'></Field>" +
                "</Method>" +
        completefunc: function (xData, Status) {
         $(xData.responseXML).find("[nodeName='z:row']").each(function() {


Mar 15, 2011 at 2:02 AM

You're right.  It I did your simple example using valuepairs and it woked also.

I wonder if the error is related to fact that I grab the starttime from the parent operation: "GetListItems"  ...  var StartTime = $(this).attr("ows_StartTime");

and later use it ...   valuepairs: [["StartTime", StartTime],

I'll need to look into it more.  Thanks for the help and direction.