我正在尝试使用图API中的文件名获取文件ID 我尝试了以下的事情,但这不起作用
https://graph.microsoft.com/v1.0/sites/ccc.sharepoint.com,dddddd,eeeeeeeeeeeeeeee/drive/root:/excelDir/filename.xlsx:/children
答案 0 :(得分:0)
得到了答案
https://graph.microsoft.com/v1.0/sites/"+webAndSiteId+"/drives/"+folderID+"/root/search(q='filename.xlsx')
以下是工作javascript
var fileCollectionEndpoint = "https://graph.microsoft.com/v1.0/sites/"+webAndSiteId+"/drives/"+folderID+"/root/search(q='"+fileNamesArray[index]+"')"
$.ajax({
url: fileCollectionEndpoint,
async: false,
dataType: 'json',
type: "GET",
cache:false,
headers: {
'Authorization':'Bearer '+token,
},
success: function (json) {
console.log(json.value[0].id);
},
error:function(xhr)
{
}
});