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've recently discovered that the Lists.asmx ignores your attempts to reset a field's value to empty string or null with Lists.UpdateListItems. Not a very well documented limitation discovered by trial and error.

Can someone advise on the possibility to reset field values using FP RPC / OWSAPI from AJAXy pages? Or am I missing something in the OOTB web service functionality / CAML syntax? I mean without deploying a custom Web Service just for that little generic task?

share|improve this question
    
What have you tried (just so I don't go and try the exact same things)? –  Marc D Anderson May 20 '10 at 17:46
    
I tried <Field></Field> and for lookups <Field>0;#</Field> and <Field>;#</Field>. To no avail. Both via AJAX calls and via u2u CAML Query Builder. I'm now looking into owsvsvr.dll calls which may be what DataView WebPart and SPD do. –  Alexey Krasheninnikov May 20 '10 at 19:40
    
Have you tried using a variable set to null or empty? –  spevilgenius May 22 '10 at 20:19
    
Where exactly? I'm not aware of a way to reference null-valued client side variables via SOAP XML-based request other than just <Field Name='' /> –  Alexey Krasheninnikov May 23 '10 at 23:45
    
Well I think I'd like to revive this discussion. Let's start a bounty. –  Alexey Krasheninnikov Jun 27 '11 at 14:27

2 Answers 2

up vote 3 down vote accepted
+50

I just did a test with SPServices where I set a Single line of text column to an empty string (""), which seemed to work just fine. This was with WSS 3.0 (the simplest test case, IMO).

  $().SPServices({
    operation: "UpdateListItems",
    async: false,
    debug:true,
    listName: "Sales Opportunities",
    ID: 5,
    valuepairs: [["StateID", ""]],
    completefunc: function (xData, Status) {
      alert(xData.responseText);
    }
  });

This generates the call:

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <UpdateListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
      <listName>Sales Opportunities</listName>
      <updates>
        <Batch OnError="Continue">
          <Method ID="1" Cmd="Update">
            <Field Name="StateID"></Field>
            <Field Name="ID">5</Field>
          </Method>
        </Batch>
      </updates>
    </UpdateListItems>
  </soap:Body>
</soap:Envelope>

EDIT:

I just did the same thing for a Lookup column and a Person or Group column. The valuepairs line is:

valuepairs: [["State", ""], ["Sales_x0020_Rep", ""]],

Both columns were "emptied".

share|improve this answer
    
OK, how about a lookup field? –  Alexey Krasheninnikov Jun 27 '11 at 20:16
    
+1, just sending <Field Name="LookupField"></Field> seems to work fine. –  Kit Menke Jun 28 '11 at 14:33
    
Yay! I got 50 points. I'll go buy something with them right away. ;+) –  Marc D Anderson Jun 29 '11 at 16:36

In the end, had to resort to writing a custom web service that also makes great bandwidth savings.

share|improve this answer
    
But that's not the definitive answer to my own inquiry whether or not there IS a way to reset a field value to null. –  Alexey Krasheninnikov Jun 27 '11 at 14:28

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.