使用SharePoint REST API创建Modern Teams站点报错:参数request不存在
问题描述
尝试通过_api/GroupSiteManager/CreateGroupEx端点创建Modern Teams站点时收到错误:
Failed: {"error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","value":"The parameter request does not exist in method CreateGroupEx."}}}
此前已通过/_api/SPSiteManager/create端点并设置"WebTemplate":"SITEPAGEPUBLISHING#0"成功创建Modern Communication站点,原创建Teams站点的请求信息如下:
url: /_api/GroupSiteManager/CreateGroupEx accept: application/json;odata.metadata=none odata-version: 4.0 method: POST body: { "request": { "Title": "Communication Site 1", "Url":"https://contoso.sharepoint.com/sites/commsite1", "Lcid": 1033, "ShareByEmailEnabled":false, "Classification":"Low Business Impact", "Description":"MyDescription", "WebTemplate":"STS#3", "SiteDesignId":"6142d2a0-63a5-4ba0-aede-d9fefca2c767", "Owner":"owner@yourtenant.onmicrosoft.com" } }
错误原因
CreateGroupEx方法的请求体不需要外层的"request"包裹,直接将参数放在JSON根节点即可——这是该端点和SPSiteManager/create端点的请求格式差异导致的问题。
修正后的请求
请求头
accept: application/json;odata.metadata=none odata-version: 4.0 method: POST url: /_api/GroupSiteManager/CreateGroupEx
请求体
{ "Title": "Teams Site 1", "Url":"https://contoso.sharepoint.com/sites/teamssite1", "Lcid": 1033, "ShareByEmailEnabled":false, "Classification":"Low Business Impact", "Description":"My Teams Site Description", "WebTemplate":"STS#3", "SiteDesignId":"6142d2a0-63a5-4ba0-aede-d9fefca2c767", "Owner":"owner@yourtenant.onmicrosoft.com" }
注:创建Teams站点时,建议将标题和URL路径调整为符合Teams站点的命名规范。
内容的提问来源于stack exchange,提问作者arresteddevelopment
相关产品推荐
相关产品推荐

