我正在尝试使用 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);
答案 0 :(得分:1)
不幸的是 you don't have the feature to create the site 在这一点上,因为它只有网站的只读属性。据说您可以使用以下解决方法 - 可以 create an office 365 group,然后分配所有者和成员,然后您将看到将自动创建一个新的 SharePoint Online 网站。