【发布时间】:2022-11-10 03:27:59
【问题描述】:
我正在尝试使用 SharePoint REST API 在 SharePoint Online 中创建新式 SharePoint 网站集。
我正在使用_api/SPSiteManager/create API 创建新站点。
我已经使用App Only model 创建了一个具有适当权限的应用程序,我可以获得一个令牌。
但是当我使用令牌进行 POST 调用时,出现以下错误。
<?xml version="1.0" encoding="utf-8"?>
<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code>-2147024891, System.UnauthorizedAccessException</m:code>
<m:message xml:lang="en-US">Access is denied. (Exception from HRESULT:
0x80070005 (E_ACCESSDENIED))</m:message>
</m:error>
我在帖子中使用的正文如下:
{"request": {
"Title": "Communication Site 1",
"Url":"https://[mytenancy].sharepoint.com/sites/commsite1",
"Lcid": 1033,
"ShareByEmailEnabled":false,
"Description":"Description",
"WebTemplate":"SITEPAGEPUBLISHING#0",
"SiteDesignId":"6142d2a0-63a5-4ba0-aede-d9fefca2c767",
"Owner":"[accountid]@[mytenancy].onmicrosoft.com",
"WebTemplateExtensionId":"00000000-0000-0000-0000-000000000000"
}}
该应用程序已被授予以下权限
<AppPermissionRequests AllowAppOnlyPolicy="true">
<AppPermissionRequest Scope="http://sharepoint/content/tenant"
Right="FullControl" />
</AppPermissionRequests>
这几乎是一个标准的帖子,使用了我能找到的尽可能多的文档。
任何想法都非常感谢。
谢谢
【问题讨论】:
-
由于仅应用程序模型基本上在网站集上添加了应用程序上下文,您能否与我们分享您在哪个网站集上创建了应用程序注册?