如何通过 Powershell 从具有属性(由我自己创建的自定义列)的共享点文件夹中获取所有文件?

How to get all the files from a folder in sharepoint with there properties(Columns which were custom created by myself) via Powershell?

如何从每个文件的共享点文件夹中获取列数据? 我能够获取所有文件的名称,但我也想获取列详细信息(列名 - 哈希,我创建)如何获取此值? 以下是到目前为止的代码(我什至能够获得所有文件的名称的计数,但无法获得哈希列或我为每个文件创建的任何其他列。)-

$SiteURL = "Some SharePoint Url"
$FolderURL= "Some SharePoint Folder in shared documents"
  
  
Try {
    #Connect to PNP Online
    Connect-PnPOnline "Some SharePoint Url" -UseWebLogin
  
    #Get All Files from the Folder
    $FolderItems = Get-PnPFolderItem -FolderSiteRelativeUrl $FolderURL -ItemType File -Recursive
     
    Write-host "Total Number of Files in the Folder:" $FolderItems.Count
    ForEach($File in $FolderItems)
    {
      Write-Host  $File.Name | Format-Table   #*Similarly if i try $File.Hash = it is not working*
    }
}
catch {
    write-host "Error: $($_.Exception.Message)" -foregroundcolor Red
}

您可以试试这个来获取文件的自定义列值:

 $FolderItems = Get-PnPFolderItem -FolderSiteRelativeUrl $FolderURL -ItemType File -Recursive
 ForEach($File in $FolderItems){
    $File.Name
    $fileURL=$FolderURL+"/"+$File.Name
    $fileItem=get-pnpfile $fileURL -AsListItem
    $fileItem['Column1']
    $fileItem['Column2']
}