Forum Discussion
Deleted
Dec 06, 2016Add-PnPListItem
Hi all , just running this powershell command, but the TItle is not being populated when I add the "PM" column value. The PM is a User/Group Column. If i remove that it works, but as soon as I add it back in the title is not populated?
Also another observation if I use
Add-PnPListItem -List "ProjectListing" -Values @{"Title"="My Title";"ExternalSharing" = "No";"Single" = "Yes";"PM" = 'me@domain.com'}
ANy thoughts would be greatly appreciated....
- Craig DebboBrass Contributor
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.
- DeletedYeah that is what i have got to work also is running Add then Set. Bur again next step was to trigger a flow on item creat, but not all fiields are set on create....
How have you gotten over that?- Craig DebboBrass 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.
- Deleted
Hi Daniel,
i think you inserted the user the wrong way it should be: "i:0#.f|membership|anotheruser@yourtenant.onmicrosoft.com";
- DeletedAccording to the docs
https://github.com/SharePoint/PnP-PowerShell/blob/master/Documentation/AddPnPListItem.md
Can use id or email address. What is weird is that if i add the list item with just the person or group field as a value it works.....wierdness