[英]How to implement LIKE(filter) on a list column using Sharepoint Rest API?
如何使用 REST API 在 SharePoint 列表的列數據上實現 LIKE? 有沒有辦法實現它?
現在的情況:
API 工作正常,但所需的結果不是完全匹配。
必需的:
所有與“John”匹配的名字都應該作為回應。
var URL = _spPageContextInfo.webAbsoluteUrl + "/_api/Web/Lists/GetByTitle('UserList')/Items?$select=UserName&$filter=UserName eq 'John')";
var response = $.ajax({type: "GET", url: URL, async: false, dataType: "json"}).responseText;
var x = jQuery.parseJSON(response);
console.log(x);
謝謝!
什么是錯誤? URL 末尾的右括號不是問題嗎?
嘗試將響應記錄到您的控制台並檢查記錄的數組,現在嘗試使用此過濾器
var URL = _spPageContextInfo.webAbsoluteUrl + "/_api/Web/Lists/GetByTitle('UserList')/Items?$select=UserName&$filter=substringof('John',UserList);
對於提交的文本
/_api/Web/Lists/getByTitle('TestList')/Items?$select=Title&$filter=substringof('John',textField)
對於用戶字段
/_api/Web/Lists/getByTitle('TestList')/Items?$select=Title,UserName/Title&$expand=UserName&$filter=substringof('John',UserName/Title)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.