如何使用该记录中的名称删除列表中的记录

时间:2018-10-01 05:28:36

标签: sharepoint sharepoint-online office365api

这是我的清单。如何使用学生姓名而不使用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.");  
        }  
    }); 
});