Error trying to update a Lookup Field in a SharePoint 2010 List using the RESTful Web Service
-
Friday, June 04, 2010 5:21 PM
I can successfully do any CRUD I want with the REST web service in SharePoint 2010. Very cool and allows everything to be very AJAXy. However, I cannot figure out how to UDPATE a field that is a lookup. I am working with the JSON data and when I update the lookup's meta data URI field, I get the following error:
Error processing request stream. Binding to new entities is not supported in PUT operations
Here is the chunk of JSON data that I am posting back to the REST Web Server URI
"MyLookupField":{
"__metedata":{
"uri":"http://the-domain/_vti_bin/listdata.svc/Target_Lookup_List(7)"
}
}The error response that comes back (courtesy of Fiddler2, thanks Fiddler folks for an awesome tool) is:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<code></code>
<message xml:lang="en-US">Error processing request stream. Binding to new entities is not supported in PUT operations.</message>
</error>Any help would be MUCH appreciated.
All Replies
-
Monday, June 07, 2010 9:07 AM
Hey CobbDev,
I'm not 100% sure but if I'm correct it's by design not possible to update an lookup field. If you haven't set the LookUp List yet, you can set the value, but it is not possible to change the field after that. I found a msdn article a few weeks ago about this topic and stopped looking for an other answer after that.
-
Monday, June 07, 2010 12:51 PMWow!!! If its by design, that's a really big reason for me to move away from the RESTful web service in favor of the Client Object Model in JavaScript. Would love to hear from some Microsoft folks on the subject.
-
Monday, June 07, 2010 1:41 PM
Hey, I think I didn't make myself clear. You can't change the reference to the LookUpList at all. You can't do it programmatically in C# nor in the Client Object Model. You can set the value once, after that you have to delete the field and create a new one.
If you open SharePoint Designer to change the referenced list for a lookup field, it's the same behaviour. You can't change it - writeable, but not changeable.
- Proposed As Answer by Andreas Blueher Thursday, August 19, 2010 3:05 PM
- Marked As Answer by Margriet Bruggeman Monday, April 23, 2012 12:16 PM
- Unmarked As Answer by Margriet Bruggeman Monday, April 23, 2012 12:16 PM
-
Tuesday, December 07, 2010 5:29 PM
Oops. Sorry, I didn't get back to this sooner. I'm not getting alerts that posts have been made to my posts on this site. Oh Well.
I think you misunderstood my original post. I am not trying to change the reference to the lookup list, I am trying to change the value. So, if I have a Lookup List with Values A, B, and C, and my main list is pointing to reference A, I want to update that reference to B or C. Maybe my syntax is simply incorrect, but there's not a lot of documentation on this from Msf. So, I had to scrap it all and go another route. Too bad, because REST is the way to go.
-
Tuesday, May 24, 2011 11:59 PM
For lookup fields, you need to use the JSON property [yourfieldname]Id. For choice fields, you need to use [yourfieldname]Value. For example:
{ Title: "My new item, MyLookupFieldId: 5, MyChoiceFieldValue: "Category B" }This would be for a list that has fields named Title, MyLookupField, and MyChoiceField, respectively.
- Proposed As Answer by Philip Lanier Tuesday, May 24, 2011 11:59 PM
- Marked As Answer by Margriet Bruggeman Monday, April 23, 2012 12:16 PM
-
Monday, August 22, 2011 2:34 PM
Philip,
I'm wondering if you've done any work with Multi-Choice fields as well.
I'm not having luck setting the values for a multi-choice field.
Your input would be appreciated!
zaanglabs.com | charliedigital.com | linkedin.com/in/charlescchen -
Thursday, June 07, 2012 1:27 AM
Hello Philip,
Like CharliDigital earlier asked, what would be the syntax for a choice field that allows multiple selection.??
-
Thursday, June 14, 2012 8:13 PM
Thanks, this worked for me. But just in case anyone else runs into it setting MyChoiceFieldValue: "Category B" did not work for me if i did a PUT. It only worked when I did a MERGE.
-
Monday, January 07, 2013 9:38 PM
Were you ever able to find the syntax for a multichoice field?

