powershellsharepointpnp.powershell

Set-PnPListItem Column '{my column name}' does not exist. It may have been deleted by another user


Something is wacky with my SharePoint list. When I use Get-PnPListItem -List $listTitle -ID $id It returns only 3 columns: Id, Title, and GUID. Likewise, when I try to use Get-PnPListItem I only have those 3 fields to choose from. If I use Set-PnPListItem -List $listTitle -Identity $id -Values @{"FieldName" = $value} it tells me "Column '{my column name}' does not exist. It may have been deleted by another user." but this is the syntax that is recommended by most sites. I haven't been able to get it to work.

If I use Get-PnPField -List $listTitle I can actually see all the fields in my list, but when I try and use Set-PnPField it seems more like how to update metadata and properties of the field rather than its actual contents.

I'm pretty lost here. How can I update my list items using PnP?


Solution

  • After some "poke and hope" I found this discussion where somebody is playing with the "UpdateType" argument that is "optional" but really shouldn't be.

    This works:

    Set-PnPListItem -Identity $id -List $listTitle -Values @{"MyField"="Field Value"} -UpdateType UpdateOverwriteVersion