Trying to take a csv file and import it into an existing SharePoint list. I started with this sample and have made some modifications for our specific case.

The example uses New-PnPBatch and Invoke-PnPBatch to batch the Add-PnPListItem cmdlets and should save on REST calls and increase the speed of our script. But when run the script with the batch feature I get errors on all of our date fields like this:

There was an exception while writing field reviewdate. Verify you're using the correct InternalName value for the field you want to write to.

There are three date fields in the list and I've checked the internal names and they are all correct. Additionally if I remove the -Batch switch (or comment it out like this)

Add-PnPListItem -List $ListName -Values $values #-Batch $batch

Then the items are added successfully to the list. Edit Also if I remove the date columns from the csv I can use the batch feature just fine. So I'm pretty sure it has something specific to do with date columns.

I see from this documentation that Add-PnPListItem is supported for batching and no mention of issue with date columns are included.

Anybody else know what is going on and why I can't use -Batch when adding list items that have dates?

  • 1
    It might be worth adding an issue to the PnP PowerShell GitHub repo, given that it works without the batch switch. Looks like a bug or at least a documentation issue: github.com/pnp/powershell/issues also are you using the latest version of PnP? Jun 13, 2022 at 20:00
  • Thanks. I am using PNP.PowerShell 1.10 and PowerShell 7.2.3. I don't know how to open an issue, but I'll give it a go. Thanks.
    – Rothrock
    Jun 13, 2022 at 20:14

1 Answer 1


Turns out that Add-PnPListItem deals with date columns differently between Batch and Non-Batch mode.

My code was round-tripping some dates exported to CSV from a list and were in a format like 4/13/2021 12:00:00 AM. This worked fine when adding items in non-batch mode. But batch mode is expecting dates in this format 2021-04-13 00:00:00.

I changed up the code a bit

$date =[datetime]::parseexact($csvDate,'M/d/yyyy h:mm:ss tt', $null)
$val = $date.ToString("yyyy-MM-dd hh:mm:ss")

And then used the $val for the value sent. This value works in both batch and non-batch.

  • Great to hear you found a solution, please mark your answer as the accepted answer to the question. Jun 15, 2022 at 22:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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