I am creating a field in SharePoint list using Add-PnPFieldFromXml command
The field is created successfully. I want to add this field to the default view of the list using the same command.
I checked Add-PnPFieldFromXml link but did not find the option to add the column in the default view.
How can I achieve the above requirement?
Or do I have to use Set-PnPView command?
below is the code I am using.
$listTitle = "Test" $listUrl = "Test" Remove-PnPList -Identity $listTitle Write-Host -ForegroundColor Magenta "Creating list: " $listURL New-PnPList -Title $listTitle -Url $listUrl -Template "GenericList" $FieldXML= "<Field Type='Note' Name='CustomField' ID='$([GUID]::NewGuid())' DisplayName='CustomField' Viewable ='TRUE' Required ='FALSE' RichText='FALSE'></Field>" Add-PnPFieldFromXml -List $listTitle -FieldXml $FieldXML