Forum Discussion
Add-PnPListItem
I've found weird things too with this command when trying to add 'people/group' fields.
But the fix was to run it twice. First run, create the item and add the person, next run, add the remaining fields.
$i = Add-PnPListItem -List $l.Title -Values @{"Approved_x0020_By"="cdebbo@abc.def"}
Set-PnPListItem -list $l.Title -Identity $i.Id -values @{"Model"="Airplane 737"; "Barcode"="737-767-dd78787"}
it works. Makes a bit of a mess if you have flow/workflows triggered on new/updated items but you can add conditions in the workflows to trigger on certain field values.
BTW- I would really love to see a Set-PnPListItemPermission command ... so I can modify permissions for individual items.
How have you gotten over that?
- Craig DebboDec 06, 2016Brass Contributor
I've only used this in one place so far and what I did was set a field (e.g "done" = "true") when all my fields are finally set. Then I trigger my workflow to run on update and to check if 'done = true'.
I suspect you've already solved this much. I don't have an answer for a new item workflow.