Hi All

I want to export the contents of a user’s OneDrive to a CSV file. When I use the below syntax, I get the output, but I have to specify the list name. Is it possible to export all the contents to a CSV file without specifying the list name? Please guide me.

#Set Variables
 $SiteURL= "https://contoso-my.sharepoint.com/personal/glenn_max_contoso_com"
 $ListName="Documents"
 #Connect to PnP Online
 Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)
 #Get All Files from the document library - In batches of 500
 $ListItems = Get-PnPListItem -List $ListName -PageSize 500
 #Loop through all documents
 $DocumentsData=@()
 ForEach($Item in $ListItems)
 {
     #Collect Documents Data
     $DocumentsData += New-Object PSObject -Property @{
     FileName = $Item.FieldValues['FileLeafRef']
     FileURL = $Item.FieldValues['FileRef']
     }
 }
 $DocumentsData | Export-Csv C:\temp\output.csv
3 Spice ups