pnp / PnP-PowerShell

SharePoint PnP PowerShell CmdLets
https://pnp.github.io/powershell
Other
985 stars 665 forks source link

[BUG] File format not returning when using Get-PnPListItem -Fields FileRef in foreach loop. #2981

Open JaggB opened 3 years ago

JaggB commented 3 years ago

Notice

Many bugs reported are actually related to the PnP Core Library which is used behind the scenes. Consider carefully where to report an issue:

  1. Are you using Apply-PnPProvisioningTemplate or Get-PnPProvisioningTemplate? No
  2. Is the issue related to the cmdlet itself, its parameters, the syntax, or do you suspect it is the code of the cmdlet that is causing the issue?

Reporting an Issue or Missing Feature

When looping through Get-PnPListItems -Fields FileRef, it doesn't show the format of the file. In the example below, the $sItems.FileRef shows correct data but $subItem.FileRef doesn't show the correct file format at the end of the string. Code:

$sItems = (Get-PnPListItem -List $_.Title -Fields "FileLeafRef", "FileRef" -PageSize 1000).FieldValues foreach ($subitem in $sItems) { $subitem.FileRef }

Expected behavior

The image below shows the correct file format for each file within the document library image

Actual behavior

The image below each file iterating through the document library and doesn't show the file format at the end image

Steps to reproduce behavior

$subitems = (Get-PnPListItem -List $_.Title -Fields "FileLeafRef", "FileRef" -PageSize 1000).FieldValues foreach ($subitem in $subitems) { $subitem.FileRef }

Which version of the PnP-PowerShell Cmdlets are you using?

What is the version of the Cmdlet module you are running?

3.26.2010.0

How did you install the PnP-PowerShell Cmdlets?