Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

REST API update value that can contain multiple users

$
0
0

I have created a test list that has only two fields: Title (text) and AssignedTo (muli-value user field, no groups). I created a single item in the list using the SharePoint interface and added two users to the the AssignedTo field. I have tried adding a third user, deleting one user, and nulling the field's value via the REST API (listData.svc) Here is the example payload of trying to delete the second person from the field:

Key	Value
Request	POST /_Layouts/_vti_bin/listdata.svc/TestList(1) HTTP/1.1
Accept	application/json, text/javascript, */*; q=0.01
If-Match	W/"3"
X-HTTP-Method	MERGE
X-Requested-With	XMLHttpRequest
Referer	http://dev-02/_Layouts/PAR/peoplepicker.aspx
Accept-Language	en-us
Accept-Encoding	gzip, deflate
Content-Length	1128
User-Agent	Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Host	dev-02
Cookie	WSS_KeepSessionAuthenticated={535c3f2a-f7de-4a31-8a43-f7fa5a0e57e3}; Ribbon.ListItem=944977|-1|281|911837184; Ribbon.ListForm.Edit=620323|-1|272|-1226667017; Ribbon.Permission=944977|-1|451|-1941869242; Ribbon.List=944977|9|33|911837184
Connection	Keep-Alive
Cache-Control	no-cache
Content-Type	application/json
{"Id": 1,"Title": "Some stuff that does not work?","AssignedTo": {"results": [
            {"__metadata": {"uri": "http://dev-02/_vti_bin/listdata.svc/UserInformationList(5)","etag": "W/\"1\"","type": "Microsoft.SharePoint.DataService.UserInformationListItem"
                },"Id": 5,"ContentTypeID": "0x010A00F0F0729F7F61C84E91A87204A17DF669","ContentType": "Person","Name": "Jason Young","Modified": "/Date(1362402512000)/","Created": "/Date(1362402512000)/","CreatedBy": {"__deferred": {"uri": "http://dev-02/_vti_bin/listdata.svc/UserInformationList(5)/CreatedBy"
                    }
                },"CreatedById": 1073741823,"ModifiedBy": {"__deferred": {"uri": "http://dev-02/_vti_bin/listdata.svc/UserInformationList(5)/ModifiedBy"
                    }
                },"ModifiedById": 1073741823,"Owshiddenversion": 1,"Version": "1.0","Attachments": {"__deferred": {"uri": "http://dev-02/_vti_bin/listdata.svc/UserInformationList(5)/Attachments"
                    }
                },"Path": "/_catalogs/users","Account": "DOM\\jyoung","EMail": "Jason.Young@domain.com","MobileNumber": null,"AboutMe": null,"SIPAddress": "Jason.Young@domain.com","IsSiteAdmin": false,"Deleted": false,"Picture": null,"Department": "IT","JobTitle": "Electronic Engineer"
            }
        ]
    }
}

I then get the following response body back:

{"error": {"code": "","message": {"lang": "en-US","value": "Error processing request stream. The payload must represent a valid array format for collections."
        }
    }
}

Could anyone give me any help with what I am doing wrong?


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>