i am writing code where i am updating rows from excel for which i have used REST api but few of my column in sharepoint are choice , persongroup,date type, when i am trying to create item for that its no working below is sample code:
function createEmployeeDetailsListItem(excelRow) {
$.ajax
({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/GetByTitle('Test')/items",
type: "POST",
data: JSON.stringify
({
__metadata:
{
type: "SP.Data.E2EVMVulnerabilitiesMappingMasterListItem"
},
Title: excelRow["Title"],
ID:excelRow["ID"],
DateCol:excelRow[""], //Datecolumn
PersonGroupCol:excelRow[""], //Persongroupcolumn
ChoiceCol:excelRow[""] //Choicecolumn
}),
headers:
{
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"X-HTTP-Method": "POST"
},
success: function (data, status, xhr) {
console.log("success");
},
error: function (xhr, status, error) {
console.log("error");
}
});
}
mm/dd/yyyy
format, for Person or Group field you will need ID you person/group and for choice column (single selection) you can pass string like "MyChoice".