Sharepoint 365应用程序在租户中没有管理权限

时间:2020-07-08 10:07:32

标签: rest sharepoint permissions

我在租户中创建了一个应用程序,该应用程序具有以下已授予和信任的应用程序权限。

<AppPermissionRequests AllowAppOnlyPolicy="true">
<AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" Right="FullControl" />
</AppPermissionRequests>

但是,当我尝试使用REST API进行KQL搜索(关键字查询语言)时,出现以下错误

<?xml version="1.0" encoding="utf-8"?>
<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
    <m:code>-1, Microsoft.Office.Server.Search.REST.SearchServiceException</m:code>
    <m:message xml:lang="en-US">Application does not have administrative permissions in tenant</m:message>
</m:error>

在邮递员中使用以下查询

https://mytenant.sharepoint.com/_api/search/query?querytext='sharepoint'&amp;refinementfilters='fileExtension:equals("docx")'

所以我的问题是:

为什么要进行搜索需要管理权限? 如何创建“完全控制” +“也搜索”的应用程序许可?

疯狂。

1 个答案:

答案 0 :(得分:0)

要使应用在租户中具有管理权限,您需要将权限范围更改为租户:

<AppPermissionRequests AllowAppOnlyPolicy="true">
  <AppPermissionRequest Scope="http://sharepoint/content/tenant" Right="FullControl" />
</AppPermissionRequests>