I have a Wiki Page in SharePoint . which i want to be populated by Build results from another server using an Automatic script , but after digging through forums and google im unable to find a good example of how to do it, I frankly dont mind what language its preformed with , but my personal preference is ether Python or Powershell, i assume its done through some API requests , but for crying out loud i was not able to find any examples . Thank you in advance .



$web = Get-SPWeb 'https://url-of-sharepoint-site'
$sitePages = $web.Lists['Site Pages']
$sitePagesUrl = $sitePages.RootFolder.ServerRelativeUrl
$wikiPageUrl = "$sitePagesUrl/name-of-wiki-page.aspx"
$wikiPage = $web.GetFile($wikiPageUrl)
if (!$wikiPage.Exists)
    $wikiPage = [Microsoft.SharePoint.Utilities.SPUtility]::CreateNewWikiPage($sitePages, $wikiPageUrl)
$wikiContent = "<p>Your Wiki page content goes here</p>"
$wikiItem = $wikiPage.Item
$wikiItem[[Microsoft.SharePoint.SPBuiltInFieldId]::WikiField] = $wikiContent
$wikiItem.Update(); # or SystemUpdate() if you wish

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.