【发布时间】:2021-01-16 14:24:59
【问题描述】:
我正在尝试使用 Graph SDK GraphServiceClient 在 SP Online 中创建另一个站点的新子站点。我已成功通过身份验证,但我似乎无法创建一个站点 - 文档很少,示例也是如此,因此它基本上是命中注定的,我不希望为此目的使用 Graph REST。有什么帮助吗?下面的代码返回一个带有“无效请求”错误的站点对象。我确定我必须缺少新 Site 对象的一些必需属性,但哪些属性?
ItemReference parent = new ItemReference();
parent.Id = SiteRootForSubsite.Id;
Site newSite = new Site
{
ParentReference = parent,
Name = SubsiteName,
WebUrl = "/documentcenter909/mynewsite"
};
Site createdSite = await _graphClient.Sites
.Request()
.AddAsync(newSite);
【问题讨论】:
-
不幸的是 you don't have the feature to create the site 在这一点上,因为它只有该站点的只读属性。据说您可以使用以下解决方法 - 可以create a office 365 group,然后分配所有者和成员一个 SharePoint Online 网站将自动创建。
标签: microsoft-graph-api sharepoint-online