PnP Powershell does not show all the fields in its output.
Its not a question but the discussion. Something I want to share that i recently found regarding PnP Powershell.
Sometime PnP powershell does not show all the fields though you have added those fields to your script. Below can be one of the reason.
I was writing a script to pull information from SharePoint list. For some reason DisplayName field was not showing any output.
Below is the sample script.
$username = "xxxxx@xxxxxxxxxxxxx .onmicrosoft.com"
$password = "xxxx"
$UserCredential = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $userName, $(convertto-securestring $Password -asplaintext -force)
Connect-PnPOnline -Url "https://xxxx.sharepoint.com/sites/Prashantv" -Credentials $UserCredential
$listItems= Get-PnPListItem -List UserList
foreach($listItem in $listitems){
Write-Host "Employeenumber" : $listItem["Title"]
Write-Host "FirstName" : $listItem["FirstName"]
Write-Host "LastName" : $listItem["LastName"]
Write-Host "DisplayName" : $listItem["DisplayName"]
Write-Host "sam" : $listItem["sam"]
Write-Host "DOJ" : $listItem["DOJ"]
Write-Host "DOB" : $listItem["DOB"]
Write-Host "title" : $listItem["Designation"]
Write-Host "manager" : $listItem["manager"]
Write-Host "Department" : $listItem["Department"]
Write-Host "Team" : $listItem["Team"]
Write-Host "SubTeam" : $listItem["SubTeam"]
Write-Host "Office" : $listItem["Office"]
Write-Host "Co" : $listItem["Co"]
Write-Host "group" : $listItem["group"]
Write-Host "upn" : $listItem["upn"]
Write-Host "company" : $listItem["company"]
Write-Host "---------------------------"
}
I could view all the fields except Displayname. After that i came to know about PnPView. This powershell will not show you output of your script but it will show you properties being used in the list.
See below.
--------------------------------------------------------------------------------------
In above you can properties called "ListViewXML'.
This will provide you fields that are being used by SharePoint in your list. If you see DisplayName parameter is already being used by SharePoint List to capture some other data. Hence It was not showing my own field from the list.
This powershell commandlet will help you to find out such fields being used by List and then you can change the name of your field to get the desired result.
Hope this will help others.