I'm trying to add an SPListItem
to an SPList
via REST
, but have a problem with User or Group and Lookup (information already on this site).
function adddullitem() {
var item = {
"__metadata": { "type": "SP.Data.OfficeReqListItem" },
"Title": "123",
"SomeUserorGroupField": "1",
"SomeLookUpField": "10"
};
$.ajax({
url: "http://SITE/_api/web/lists/getByTitle('LISTNAME')/items",
type: "POST",
contentType: "application/json;odata=verbose",
data: JSON.stringify(item),
headers: {
"Accept": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val()
},
success: function (data) {
//success(data);
},
error: function (data) {
//failure(data);
}
});
}
I'm trying to pass user's ID to User and group field and SPListItem.ID
to LookUp field, but it doesn't work.