Forum Discussion
Deleted
Mar 10, 2017Add-PnPListItem triggers an error when used with values
Hi folks, I'm new to SharePoint and developing for it so this could be a user error on my part but I'm really stuck and hope someone can help. I wrote a simple powershell script to connect to...
Deleted
I don't understand what that code is doing Nigel.
I can see the operation is returning into a variable $new_item but how can you reference $new_item.id in the operation when it won't be set until after the operation finishes?
I can see the operation is returning into a variable $new_item but how can you reference $new_item.id in the operation when it won't be set until after the operation finishes?
Nigel_Price9911
Oct 10, 2017Iron Contributor
Hi Chris
The Add-PnPListItem command adds a new, blank (empty) list item to the list.
and saves it in a variable $new_item.
The Set-PnPListItem command then uses the id of the empty list item ($new_item.id) to retrieve it and updates it with the values set out in the Set-PnPListItem command.
Regards
Nigel