Im new on SharePoint 2016 and i want "POST" items to list `

var data = JSON.stringify($scope.formData);  
data = data.replace(/[{}]/g, '');  
var datavalue = "{__metadata:{'type':'SP.Data.Task_x0020_ScheduleListItem'}," + data + "}";  
   //url is working fine , I just took out complete url and placed end point here 
    method: "POST",  
    headers: {  
        "Accept": "application/json;odata=verbose",  
        "Content-Type": "application/json;odata=verbose",  
        "X-HTTP-Method": "POST"  
    data: datavalue 
}).then(function(response) {  
    digestValue=" ";
}, function(response) {  

could anyone please check what is wrong with this ? i have added digest value also but when I make post call i get this error

error: {code: "-1, Microsoft.SharePoint.Client.InvalidClientQueryException", message: {lang: "en-US",…}}
code: "-1, Microsoft.SharePoint.Client.InvalidClientQueryException"
message: {lang: "en-US",…}
lang: "en-US"
value: "A 'PrimitiveValue' node with non-null value was found when trying to read the value of a navigation property; however, a 'StartArray' node, a 'StartObject' node, or a 'PrimitiveValue' node with null value was expected."

data that i am passing :

{__metadata:{'type':'SP.Data.Task_x0020_ScheduleListItem'},"Task_x0020_Type":"Reporting","Country":"America","Title":"a","Schedule_x0020_Type":"Monthly","Monthly_x0020_Type":"Day","Assignee":"results":["Title":"Lye, Nicholas"],"Escalation_x0020_Point":"results":["Title":"Lye, Nicholas"],"Due_x0020_Hour":"? undefined:undefined ?","Due_x0020_Min":"? undefined:undefined ?","Relevant_x0020_Documents":"ff###@http;://vv$$$","Monthly_x0020_Value":"30"}
  • 1
    This error is not related to digest value. This is due to the data you are passing is wrong(not according to data types of list columns). I guess there is wrong data after "Assignee" field in data. Dec 23, 2018 at 13:19
  • If you can provide data types of the columns then it will be helpful to understand what is wrong. Dec 23, 2018 at 13:20
  • Welcome. You can answer your own question below. So that others can get help from it, if they come across the same issue. Dec 24, 2018 at 3:59

2 Answers 2


For multiple user filed, the JSON should be similar as

var itemProperties = {
    '__metadata' : { 'type':'SP.Data.Task_x0020_ScheduleListItem' },
    'Title': 'a',
    'AssigneeId' : { 'results': [user1id,user2id] }

The value of metadata should be the list name.

Example: If your list name is Employee then the type field should be EmployeeListItem.

 var item = {
       "__metadata": { "type": "SP.Data.EmployeeListItem"  },
       "Title": "MISS",
       "FirstName": "Rudrani",
       "LastName": "Patil"                   


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.