Pergunta

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 ?

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a sharepoint.stackexchange
scroll top