尝试使用Microsoft Graph API搜索Sharepoint文件 [英] Trying to search Sharepoint files using Microsoft Graph api

查看:261
本文介绍了尝试使用Microsoft Graph API搜索Sharepoint文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用Microsoft Graph API(新的Office365统一API最近重命名为此).我们有一个OAUTH登录,其中graph.microsoft.com资源用于生成令牌.可以很好地获取其他子资源,例如/me.但是,当使用Microsoft Graph的文档中讨论搜索驱动器(和SharePoint?)的URL时,我们找不到找到使任何示例URL正常工作的方法.当用户可以使用驱动器或SharePoint时,它将不起作用.

We are using the Microsoft Graph API (new, Office365 unified API renamed to this recently). We have an OAUTH login, with the graph.microsoft.com resource used to generate a token. It works fine to get other subresources such as /me. But when using the URL in Microsoft Graph's documentation that talks about searching drive (and SharePoint?) we cannot find a way to make any sample URL work. It doesn't work when a drive is available for the user nor when SharePoint.

第一个问题,为什么这会产生错误?

So first question, why does this generate an error?

GET https://graph.microsoft.com/v1.0/drive/root/Microsoft.Graph.search?q=img

返回错误请求:

Error: 400 - Bad Request
See Response Headers for details.
{
"error": {
"code": "BadRequest",
"message": "Unsupported segment type.",
"innerError": {
  "request-id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
  "date": "2015-11-23T16:58:26"
}
}
}

这是响应标题:

Transfer-Encoding: chunked
request-id: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
client-request-id: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"West US","Slice":"SliceB",
"ScaleUnit":"002","Host":"AGSFE_IN_4","ADSiteName":"WST"}}
OutBoundDuration: 0
Duration: 2.2283
Cache-Control: private
Date: Mon, 23 Nov 2015 16:58:25 GMT
Server: Microsoft-IIS/8.5
X-Powered-By: ASP.NET

问题的第二部分,这是否还会在提示时搜索Sharepoint?图形API内没有单独的API.

And second part of the question, does this also search Sharepoint as it hints? There is no separate API for doing so within the graph API.

推荐答案

正确的请求URL是

The correct request URL is https://graph.microsoft.com/v1.0/drive/root/microsoft.graph.search(q='img')

我创建了 https://github.com/OfficeDev/microsoft-graph- docs/issues/51 来更正文档.

这篇关于尝试使用Microsoft Graph API搜索Sharepoint文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆