0

I am currently exploring PnP.PowerShell and the ability to create and modify modern pages, but I have not been able to find any information on whether it's possible to create a News Link similar to what you can in the UI?

enter image description here

Any ideas?

Updated

Ok - so apparently news link is referred to as a Repost Page, so you can actually create a news link page with PowerShell like this:

Add-PnPPage -Name "test" -LayoutType RepostPage

But I have still not figured out how to set the repost page source URL and my fear is that this only supports reposting SharePoint pages so far.

I tried the following, but without any luck so far.

$Page = Add-PnPPage -Name "test" -LayoutType RepostPage
$Page.RepostSourceUrl = "https://www.youtube.com/watch?v=dHTEc4XIF4Y"
$Page.Publish()

1 Answer 1

1

You are missing the Save of the page with the modified properties before publishing it. The following script will get your page published with everything you need.

$Page = Add-PnPPage -Name "test" -LayoutType RepostPage $Page.RepostSourceUrl = "https://www.youtube.com/watch?v=dHTEc4XIF4Y" $Page.Save() $Page.Publish()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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