Forum Discussion
Add-PnPListItem triggers an error when used with values
The - List parametr expects a list object.
So it is better to include this
$list = Get-PnPList -Identity $listname Add-PnPListItem -List $list -Value $itemValues
Pieter,
I tried your advice but it still crashes with the same error.
It doesn't look like that's the issue.
- Mar 13, 2017
Hi Deleted,
I've reproduced the error on a task list. Then I created a new custom list and I got the same issue.
Then I tried the same in a differnt tenant and it all worked fine.
The only other differnce is that I'm running PnP PowerShell froma differnt machine today. Friday I had a slightly later version of PnP. Could you try this with the March release?
- DeletedMar 15, 2017
Hi Pieter,
I get the same results with the February and March versions.
When I installed the January version the script worked as expected.
Maybe this is a bug introduced in the February update?
- Mar 16, 2017
Deleted,
Yes it looks like this was introduced in February. One workaround would be to run the Add-PnPListItem (without parameters) and then run Set-PnPListItem to set the properties.
- Adri Dijk, vanMar 13, 2017Brass Contributor
Here the same error with the list item, appears that is happens since the februari release of pnp.
- Mar 13, 2017
It looks like I had the January release last week.
Vesa Juvonen, it looks like a bug was introduced in February