Sporule Sporule - 1 year ago 91
reST (reStructuredText) Question

SharePoint 2010 REST API, Post Content to a list that contains "USERS" Column

For example I have a list call "shopping list", it has 2 columns.
1st Column Type is People or Groups(Allows Multiple People), the Column Name is "Customers".
2nd Column Type is string.

I can use ajax to post information to the normal SharePoint List, but just not to this Shopping List.
I know how to format the data for single user column, but not for multiple users column, The single user column is something like:
The column name is Customer, the data format should be:


I have tried lots of way to format the data, but it is still the same. The server return 500 without any useful information.
Example formats below:

item.Customers = [1,2,3] //1,2,3 is the user id in SharePoint.
item.CustomersID=[1,2,3] //1,2,3 is the user id in SharePoint.

I can confirm that the javascript object has been stringify and the post request is correctly sent as I successfully added new items to the same list without filling in the Customers Column.

Can someone please advise me what is the correct format to post content to SharePoint 2010 REST API with multiple user columns.

Answer Source

In case of SharePoint 2010 REST Interface the proper payload for multi-valued user field should look like below:

'<MultiUserFieldName>': [
        __metadata: { 
            "uri": "<WebUrl>/_vti_bin/listdata.svc/UserInformationList(<UserId>)"


  • MultiUserFieldName - user field name
  • WebUrl - absolute web url
  • UserId - user Id

JavaScript example

var webUrl = "http://contoso.intranet.com";
var listName = "ShoppingCart";
var properties = {
    'Title': 'Item #123',
    'Customers': createPayloadForMultiUserField(webUrl,[1,2,3])

    console.log('Item ' + data.d.Title + ' has been created'); 


function createListItem(webUrl,listName, itemProperties) {
    return $.ajax({
        url: webUrl + "/_vti_bin/listdata.svc/" + listName,
        type: "POST",
        processData: false,
        contentType: "application/json;odata=verbose",
        data: JSON.stringify(itemProperties),
        headers: {
            "Accept": "application/json;odata=verbose"

function createPayloadForMultiUserField(webUrl,userIds)
    return userIds.map(function(id){
        return { 
            __metadata: { 
                "uri": webUrl + "/_vti_bin/listdata.svc/UserInformationList(" + id + ")"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download