我正在尝试使用 . 这是代码:
using PnP.Framework;
TeamSiteCollectionCreationInformation modernteamSiteInfo = new TeamSiteCollectionCreationInformation
{
Description = siteDescription,
DisplayName = siteTitle,
Alias = siteUrl.AbsoluteUri,
IsPublic = true,
Lcid = (uint)lcid,
};
var createModernSite = await clientContext.CreateSiteAsync(modernteamSiteInfo);
我不太确定如何启动 ClientContext,因为我认为它应该使用https://tenant-admin.sharepoint.com。如何获取 ClientContext 对象?
我尝试使用当前 ClientContext 中的相同对象,但收到以下错误消息:
目前不支持 App-Only,除非您提供 Microsoft Graph 访问令牌。 StackTrace:在 PnP.Framework.Sites.SiteCollection.CreateAsync(ClientContext clientContext, TeamSiteCollectionCreationInformation siteCollectionCreationInformation, Int32 delayAfterCreation, Int32 maxRetryCount, Int32 retryDelay, Boolean noWait, String graphAccessToken, AzureEnvironment azureEnvironment) 在 Microsoft.SharePoint.Client.ClientContextExtensions.CreateSiteAsync(ClientContext clientContext, TeamSiteCollectionCreationInformation siteCollectionCreationInformation)