Попробуйте этот подход:
OfficeDevPnP.Core.AuthenticationManager authMgr = new OfficeDevPnP.Core.AuthenticationManager();
string siteUrl = "https://******.sharepoint.com/sites/CommunitySite";
string userName = "userh@******.onmicrosoft.com";
string password = "******";
using (var ctx = authMgr.GetSharePointOnlineAuthenticatedContextTenant(siteUrl, userName, password))
{
Web web = ctx.Web;
ctx.Load(web);
ctx.ExecuteQueryRetry();
List sitePagesList = web.Lists.GetByTitle("Site Pages");
ctx.Load(sitePagesList);
ctx.Load(sitePagesList.RootFolder);
ctx.ExecuteQueryRetry();
var pageTitle = "home.aspx";
sitePagesList.RootFolder.Files.AddTemplateFile(sitePagesList.RootFolder.ServerRelativeUrl + "/" + pageTitle, TemplateFileType.StandardPage);
ctx.ExecuteQueryRetry();
}
}
Переключение между современным и классическим c дизайном:
#Get the Web Scoped Feature
$web = $context.Web
# Feature Title : EnableDefaultListLibrarExperience, Scope : Web
$featureguid = new-object System.Guid "52E14B6F-B1BB-4969-B89B-C4FAA56745EF"
#To Enable/Disable the Modern UI, comment and uncomment the below two lines, either to Add or Remove
#$web.Features.Add($featureguid, $true, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None)
$web.Features.Remove($featureguid, $true)
$context.ExecuteQuery()