1

I want to search for a cell value in a list and only update the match where items are multivalue cells. I'm not sure if my terminology is accurate but I hope I can explain what I mean.

I'm able to search and get a match but updating the values for multivalue cells overwrites all the cell values.

I have a minimal test list with one column: User

This column is of the type 'Person or Group'. In PS the property is called: TypedObject and its value is Microsoft.SharePoint.Client.FieldUser

As this type accepts multiple values (email addresses in my case) I added two users here:

Add-PnPListItem -List $newList -Values @{"User" = "[email protected]","[email protected]"} -ContentTyp Item

If I then try to search for [email protected] and only replace it with [email protected] all the values are replaced, i.e. [email protected] as well:

Get-PnPListItem -List "Test" | Where-Object {$_.FieldValues.User.Email -eq "[email protected]} | Set-PnPListItem -List "Test"  -Values @{"User" = "[email protected]"}

The result is that the cell doesn't contain two values ([email protected], [email protected]) but only [email protected].

Is there a way to only replace one value instead of all of them?

Thanks a lot in advance.

1 Answer 1

0

Set-PnPListItem command is used to update a list item, if you want the updated column contains multiple values, you need to set multiple values in the Set-PnPListItem command.

2
  • Thanks. So I actually wanted more like a replace option for one value within a cell that contains multiple values instead of updating the whole cell. I guess that`s not possible as I have not found any other option than to update the whole cell. Sep 11, 2017 at 11:09
  • yes, there is no way to replace one value of multiple user column, you need to update the entire column's values.
    – Kally_MSFT
    Sep 13, 2017 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.