Last active
July 7, 2023 14:49
-
-
Save vman/2f7b3b98c8041cc987ead19ba215852d to your computer and use it in GitHub Desktop.
Update SharePoint List items without using the '__metadata' property (ListItemEntityTypeFullName)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
'use strict'; | |
var requestHeaders = { | |
'X-RequestDigest': $("#__REQUESTDIGEST").val(), | |
"accept": "application/json;odata=nometadata", | |
"content-type": "application/json;odata=nometadata", | |
"IF-MATCH": "*", | |
"X-HTTP-Method":"MERGE" | |
}; | |
var listItemData = { | |
'Title': "Updated without using '__metadata' property", | |
} | |
$.ajax({ | |
url: _spPageContextInfo.webAbsoluteUrl + "/_api/lists/GetByTitle('MyCustomList')/items(1)", | |
type: "POST", | |
headers: requestHeaders, | |
data: JSON.stringify(listItemData), | |
success: function (data) { | |
console.log(data) | |
}, | |
error: function (jqxr, errorCode, errorThrown) { | |
console.log(jqxr.responseText); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment