I have created a Summary Link field and added it to a page layout and created a page based on this page layout. I have tried to add links to the summary link using powershell but the links do not appear. here is my code:
$web = get-spweb "http://siteurl"
$pubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)
$pagesListName = $pubWeb.PagesListName
$defaultAspxFile = $pubWeb.GetPublishingPage("$pagesListName/default.aspx")
$summaryLinkFieldValue = New-Object Microsoft.SharePoint.Publishing.Fields.SummaryLinkFieldValue
$groupLink = New-Object Microsoft.SharePoint.Publishing.SummaryLink("My group")
$groupLink.IsGroupHeader = $true
$summaryLinkFieldValue.SummaryLinks.Add($groupLink)
$linkLink = New-Object Microsoft.SharePoint.Publishing.SummaryLink("my link")
$linkLink.LinkUrl = "http://www.test.se"
$summaryLinkFieldValue.SummaryLinks.Add($linkLink)
#$defaultAspxFile.CheckOut()
$pageItem = $defaultAspxFile.ListItem
$pageItem[[Microsoft.SharePoint.Publishing.FieldId]::SummaryLinks] = $summaryLinkFieldValue
$defaultAspxFile.Update()
$web.Update()
when I check $pageItem[[Microsoft.SharePoint.Publishing.FieldId]::SummaryLinks] in powershell it contians the link but it does not appear on the page.