Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Add-PnPListItem doesn't work when paired with -Batch and trying to update users or group column with Id #2842

Closed
1 of 6 tasks
AdoTbo opened this issue Feb 23, 2023 · 3 comments · Fixed by #2879
Closed
1 of 6 tasks
Labels
bug Something isn't working

Comments

@AdoTbo
Copy link

AdoTbo commented Feb 23, 2023

Reporting an Issue or Missing Feature

Reporting an issue

Expected behavior

Add-PnPListItem with -Batch switch to successfully update people or group column with Id's.
Removing batch works as expected.

Actual behavior

When trying to update people or group column in a batch, with user or group Id it fails.

Error message:
"You need to provide the user via it's principal when adding a list item or when updating it via one of the Update() methods. Updating using SystemUpdate() or SystemUpdateOverwriteVersion() do work with just the user id value"

Steps to reproduce behavior

$CreationBatch = New-PnPBatch
$ListName = "MyTestList"
$ItemValues = @{"ItemID" = "{123456789}"; "Month"="Jan 23"; "Debitor"="MyDebtor"; "AuthorizationGroup"="94", "Jon.Doe@Contoso.com", "125";}
Add-PnPListItem -List $ListName -Batch $CreationBatch -Values $ItemValues
Invoke-PnPBatch -Batch $CreationBatch

What is the version of the Cmdlet module you are running?

ModuleType Version PreRelease Name PSEdition ExportedCommands


Manifest 1.12.0 PnP.PowerShell Core,Desk {Add-PnPAdaptiveScope…
Manifest 1.11.0 PnP.PowerShell Core,Desk {Add-PnPAdaptiveScope…

Which operating system/environment are you running PnP PowerShell on?

  • Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : please specify
@AdoTbo AdoTbo added the bug Something isn't working label Feb 23, 2023
@gautamdsheth
Copy link
Collaborator

You need to specify the user values as -Values @{"Person" = "user1@domain.com"}, can you please test it like that and let us know ?

@AdoTbo
Copy link
Author

AdoTbo commented Feb 26, 2023

Hi and thanks for your reply.

This is exaclty what I'm doing and in this specific example I'm adding two ID's of groups and one user value.
Adding an user like you mentioned will work, the bug arises when I try to add a group.

The very same call will work when the "-Batch" switch is removed.

Kind regards,
Adnan

@AdoTbo AdoTbo changed the title [BUG] Add-PnPListItem + batch not working with groups in people or groups column [BUG] Add-PnPListItem & Set-PnPListItem don't work when paired with -Batch and trying to update users or group column with ID's Feb 27, 2023
@AdoTbo AdoTbo changed the title [BUG] Add-PnPListItem & Set-PnPListItem don't work when paired with -Batch and trying to update users or group column with ID's [BUG] Add-PnPListItem doesn't work when paired with -Batch and trying to update users or group column with Id Feb 27, 2023
gautamdsheth pushed a commit to gautamdsheth/powershell that referenced this issue Mar 10, 2023
KoenZomers added a commit that referenced this issue Mar 10, 2023
Fix #2842 - issue with Add-PnPListItem not able to set SP groups
@PerOve
Copy link

PerOve commented Aug 22, 2023

I know it is closed, but I have the exact same issue using PnP.PowerShell 2.2.48.

@KoenZomers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants