GraphServiceClient 创建新的 SharePoint Online 网站
GraphServiceClient to create a new SharePoint Online Site
我正在尝试使用 Graph SDK GraphServiceClient 在 SP Online 中创建另一个站点的新子站点。我已经成功通过身份验证,但我似乎无法创建网站 - 文档和示例一样稀缺,所以它基本上是偶然的,我不希望为此目的使用 Graph REST。有什么帮助吗?下面的代码 returns 一个带有“无效请求”错误的 Site 对象。我确定我一定缺少新 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 at this point as it only has Read only properties for the site. Being said that you can use the following workaround - can create an office 365 group,然后分配所有者和成员,然后您将看到一个新的 SharePoint Online 网站将自动创建。
我正在尝试使用 Graph SDK GraphServiceClient 在 SP Online 中创建另一个站点的新子站点。我已经成功通过身份验证,但我似乎无法创建网站 - 文档和示例一样稀缺,所以它基本上是偶然的,我不希望为此目的使用 Graph REST。有什么帮助吗?下面的代码 returns 一个带有“无效请求”错误的 Site 对象。我确定我一定缺少新 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 at this point as it only has Read only properties for the site. Being said that you can use the following workaround - can create an office 365 group,然后分配所有者和成员,然后您将看到一个新的 SharePoint Online 网站将自动创建。