How to use set-pnplistitem if columns have spaces?

Steve Wright 81 Reputation points
2020-08-25T20:14:27.803+00:00

I am trying to use Set-PnPListItem to set a column (metadata) value but it doesn't work if the column name has a space in it. I have seen some very old posts that say to remove the spaces from the field name but keep them for the display name, but I've no idea how to do that.

Is there a proper way to handle columns with spaces in the names or must I really remove them?

BTW, I was using the "Set metadata of an existing file" example here as my reference.

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,622 questions
{count} votes

1 answer

Sort by: Most helpful
  1. JoyZ 18,041 Reputation points
    2020-08-26T02:18:07.577+00:00

    PLease use the internal name of field.

    Go to list settings> click on the column and get its internal name in address bar as shown below:

    20258-image.png

    References:

    https://learn.microsoft.com/en-us/powershell/module/sharepoint-pnp/set-pnplistitem?view=sharepoint-ps

    https://plumsail.com/docs/help-desk-o365/v1.x/How%20To/Find%20the%20internal%20name%20of%20SharePoint%20column.html


    If the response is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments