制作一个Wiki页面库(不是发布维基),可以添加包含下面内容的页面,但是当页面呈现时没有SharePoint Chrome,只显示我的内容。这是代码。我似乎还有一个属性可以添加,因此母版页生效了吗?
$FileCreationInformation = New-Object Microsoft.SharePoint.Client.FileCreationInformation
$FileCreationInformation.Url = $FileRef
$FileCreationInformation.Overwrite = $true
$FileCreationInformation.Content = [System.Text.Encoding]::UTF8.GetBytes($HTMLPageContent)
$wikiFile = $WikiPageList.RootFolder.Files.Add($FileCreationInformation)
$ClientContext.Load($wikiFile)
$ClientContext.ExecuteQuery()
答案 0 :(得分:1)
使用Utility.CreateWikiPageInContextWeb method在Wiki Page Library
中创建页面:
Function Create-WikiPage([Microsoft.SharePoint.Client.ClientContext]$Context,[string]$WikiLibraryTitle,[string]$PageName,[string]$PageContent)
{
$wikiLibrary = $Context.Web.Lists.GetByTitle($wikiLibraryTitle)
$Context.Load($wikiLibrary.RootFolder)
$Context.ExecuteQuery()
$wikiPageInfo = New-Object Microsoft.SharePoint.Client.Utilities.WikiPageCreationInformation
$wikiPageInfo.WikiHtmlContent = $PageContent
$wikiPageInfo.ServerRelativeUrl = [String]::Format("{0}/{1}", $wikiLibrary.RootFolder.ServerRelativeUrl, $PageName)
$wikiFile = [Microsoft.SharePoint.Client.Utilities.Utility]::CreateWikiPageInContextWeb($Context, $wikiPageInfo)
$context.ExecuteQuery()
}
<强>用法强>
$context = New-Object Microsoft.SharePoint.Client.ClientContext($Url)
Create-WikiPage -Context $Context -WikiLibraryTitle "KBList" -PageName "Welcome.aspx" -PageContent "Welcome to the SharePoint!"
$context.Dispose()