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

查看:25
本文介绍了尝试使用 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

R 返回错误请求:

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 是 https://graph.microsoft.com/v1.0/drive/root/microsoft.graph.search(q='img')

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 以更正文档.

I created https://github.com/OfficeDev/microsoft-graph-docs/issues/51 to correct the documentation.

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

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