所以我有一个程序需要检查驱动器中的文件夹或子文件夹中是否存在文件。尝试着奔跑
/drives/{driveid}/items/{folderid}/search(q='{fullfilename or partialfilename}')
大多数文件不显示任何内容,因为它们不包含空格。正在寻找 .仅显示文件夹中带有空格的异常值文件
SharePoint REST API 的搜索端点使用关键字查询语言 (KQL) 来执行搜索。在搜索端点中使用 q 参数时,您可能会遇到某些字符的问题。例如,空间可能需要以特定方式处理。
var endpointUrl = _spPageContextInfo.webAbsoluteUrl + "/_api/search/query?querytext='example%20file.txt'";
$.ajax({
url: endpointUrl,
method: "GET",
headers: { "Accept": "application/json; odata=verbose" },
success: function (data) {
// Process the search results
console.log(data);
},
error: function (error) {
console.log(error);
}
});