Cloudrail – OneDrive API:高级search请求失败

我正在使用cloudrail Node.Js v2.17.3。

我必须在OneDrive API上进行高级请求。

authentication部分和获取/存储凭证已成功。 这是我必须要做的(根据OneDrive的文档):/drive/root/search(q='IMG_001.jpg')

当然,该文件存在于我的OneDrive帐户中。

这里是代码:

const req = new cloudrail.types.AdvancedRequestSpecification("/drive/root/search(q='IMG_001.jpg')"); req.setMethod("GET"); req.setHeaders({"Content-Type": "application/json"}); service.advancedRequest(req, (err, res) => { console.log(err, res); }); 

Err.message说:“无效的API或资源”。

但是,当我尝试简单的请求“/驱动器/根/儿童”,它的工作原理…

先谢谢你。

据我所知,微软最近推出了新的graphicsAPI,供所有的服务使用。 所以你提到的文档是用于新的API。 尝试使用“/ drive / items / {the_folder_id或root} /view.search?q=txt”。 您也可能需要对参数进行url编码。 所以最安全的解决scheme可能是这样的:

 const url = "/drive/items/root/view.search?q=" + encodeURIComponent("[search query]"); const req = new cloudrail.types.AdvancedRequestSpecification(url); req.setMethod("GET"); service.advancedRequest(req, (err, res) => { console.log(err, res); }); 
Interesting Posts