1

I am creating pages though Sharepoint PnP PowerShell and have been able to set the Title for the page.

Add-PnPClientSidePage -Name "Sample Page"
Set-PnPClientSidePage -Identity "Sample Page" -Title "Sample Page Title"

There is a custom Choice Field column called "Item Language" (values fr or en) defined for the Site Pages list.

How can I set the Item Language column value for a page added with Add-PnPClientSidePage ?

1

This needs some additional commandlets to be executed as we cannot yet set the value of custom columns using Set-PnPClientSidePage command.

For this, you need to use the internal name of the column Item Language.

Secondly, you need to use Get-PnPClientSidePage command to get the created page and then use its Id to set the value of your column as below:

Add-PnPClientSidePage -Name “Sample Page”
Set-PnPClientSidePage -Identity "Sample Page" -Title "Sample Page Title"
$page = Get-PnPClientSidePage -Identity "Sample Page"
Set-PnPListItem -List "Site Pages" -Identity $page.PageListItem.Id -Values @{"ItemLanguage"="fr"}

Please change the value of column to that of the internal name of the column in your environment.

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.