すべて、SharePoint OnlineのPowerShellのCSOMカスタムテンプレートからリストを作成
私はPowerShellとCSOMを使用してSharePoint Onlineのためのコンテンツを含むカスタムリストテンプレートを使用してリストを作成しようとしています。今のリストテンプレートは、既にサイトコレクションに読み込まれています。 UIを通過すると、コンテンツを含むテンプレートを使用して問題のないサイトでリストを作成できます。私がpowershellでそれをやろうとすると、リストは作成されますが、列やコンテンツは作成されません。
$clientContext = New-Object Microsoft.SharePoint.Client.ClientContext($url)
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $securePassword)
$clientContext.Credentials = $credentials
if (!$clientContext.ServerObjectIsNull.Value)
{
Write-Host "Connected to SharePoint Online site: '$Url'" -ForegroundColor Green
}
$web = $clientContext.Web
$templates = $clientContext.Site.GetCustomListTemplates($web)
$clientContext.Load($templates)
$clientContext.ExecuteQuery()
$template = $templates | Where-Object{ $_.Name -eq "SomeTemplate" }
$lci = New-Object Microsoft.SharePoint.Client.ListCreationInformation
$lci.Title = "Some List"
$lci.TemplateFeatureId = $template.FeatureId
$lci.TemplateType = $template.ListTemplateTypeKind
$lci.DocumentTemplateType = $template.ListTemplateTypeKind
$lists = $clientContext.Web.Lists;
$clientContext.Load($lists);
$clientContext.ExecuteQuery();
$list = $lists.Add($lci)
$list.Update()
$clientContext.ExecuteQuery()
私には分からないことが分かりません。何か助けていただければ幸いです。
また、このようなSPオンライン操作のための非常に有用な記事と主なモジュール: https://gallery.technet.microsoft.com/SharePoint-Module-for-5ecbbcf0#content –