0

Hi I have this code which work great. But now I want to export the list in a certain view I have created. How can I do that.

$hashTable = @()
$items = Get-PnpListItem -List "MySchedule"
foreach($item in $items)
{
$HashTable += New-Object psobject -Property @{ 
'Datum'=$item.FieldValues.Datum.ToLocalTime().ToString("dd.MM.yyyy");
'00:00 - 07:59'=$item.FieldValues._x0030_0_x003a_00_x0020__x002d__;
'08:00 - 16:59'=$item.FieldValues._x0030_8_x003a_00_x0020__x002d__;
'17:00 - 23:59'=$item.FieldValues._x0031_7_x003a_00_x0020__x002d__;  
'Opmerkingen'=$item.FieldValues.Opmerkingen; 
  } 
} 
$hashTable | Select Datum,'00:00 - 07:59','08:00 - 16:59','17:00 - 23:59',Opmerkingen |
epcsv "c:\temp\myschedule.csv" -NoT

Gr, P

1

See this blog. It has a step-by-step walk-through.

You will be using the /_vti_bin/owssvr.dll RPC endpoint. See MSFT documentation here

  • I don't understand. I use the PnPowershell module not the Microsoft module, This is what I need in PnpPowershell: $library = $web.Lists["Test"] $view = $library.Views["All Documents"] – Peter Kiers Jan 16 at 20:22
  • you can substitute the PNP equivalents for the SharePoint on-prem cmdlets. $library = $web.Lists["Test"] $view = $library.Views["All Documents"] are just objects. you can retrieve the objects like so: $library = Get-PnPList -identity "lists/test"; there is no OOB way other than adapting the code in the blog. – A.k.A. Fritz Jan 16 at 20:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.