这是我的清单。如何使用学生姓名而不使用ID删除记录。这是我尝试使用ID删除功能的代码。
$("#btnDeleteStudent").click(function()
{
var IdNo = $("#txtDeleteStudent").val();
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getByTitle('Student Details')/items("+IdNo+")",
type: "DELETE",
headers: {
"Accept": "application/json;odata=verbose" ,
"contentType": "application/json;odata=verbose" ,
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"IF-MATCH": "*",
"X-HTTP-Method": "DELETE"
},
success: function(data) {
alert("Item Deleted successfully");
},
eror: function(data) {
alert("An error occurred. Please try again.");
}
});
});
答案 0 :(得分:0)
您可以编写一个CAML查询来执行相同的操作。 请参考这些链接以获取更多详细信息: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/467ca160-108d-4540-8dd7-4d5c8e3f6594/delete-list-items-through-caml-query?forum=sharepointdevelopment
http://www.dotnetspider.com/resources/43543-Delete-Lists-items-from-SharePoint-site-using.aspx
感谢和问候, 普鲁沙坦