Javascript 如何使用microsoft graph api中的文件名获取Excel文件id?

Javascript 如何使用microsoft graph api中的文件名获取Excel文件id?,javascript,microsoft-graph-api,Javascript,Microsoft Graph Api,我正在尝试使用graph API中的文件名获取文件Id 我尝试了以下方法,但不起作用 https://graph.microsoft.com/v1.0/sites/ccc.sharepoint.com,dddddd,eeeeeeeeeeeeeeee/drive/root:/excelDir/filename.xlsx:/children 得到答案了吗 https://graph.microsoft.com/v1.0/sites/"+webAndSiteId+"/drives/"+folderI

我正在尝试使用graph API中的文件名获取文件Id 我尝试了以下方法,但不起作用

https://graph.microsoft.com/v1.0/sites/ccc.sharepoint.com,dddddd,eeeeeeeeeeeeeeee/drive/root:/excelDir/filename.xlsx:/children
得到答案了吗

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)
    {

    }
});