I have 46 lists on my online sharepoint environment. I want a list in powershell of the last date of all the sharepoint lists. Here is a line of code which I have for every list:
write-host "MYLIST: " (get-pnplistitem -list "MYLIST" | select -Last 1)["Datum"].ToLocalTime().ToString("dd-MM-yyyy")
Executing the code for 46 list generates a table in PowerShell. Now I need that table exported to a CSV file. How can I do that?
I know the code is:
$results | export-csv -Path c:\temp\so.csv -NoTypeInformation
But I don't know how to get the table in powershell exported to csv.