I have a SharePoint list with a column that only accepts images called Photo (SharePoint Online environment).
I'm trying to add a new image to each row programmatically, but so far I've had no luck.

My idea was to use the PnP Powershell module, as it seemed like the logical approach. There's this cmdlet called Set-PnPListItem and the parameter -Values has an interesting line in the documentation:


From that I tested it by running the following line:

Set-PnPListItem -List "<list-name>" -Identity 1 -Values @{"Photo" = "<random-google-photo-url>"}

The identity 1 corresponds to row that already has an image that I uploaded manually via the normal SharePoint interface. Running this should have had in theory changed the image to the random one I passed as value in the hashtable, but in fact I got this error instead:


I'm not too familiar with SharePoint architecture. Am I missing something? Is there an easier way to this (perhaps via API)?

  • What is the data type of your column? Image or "Hyperlink or Picture"? Apr 7, 2021 at 16:36
  • It's of type Image
    – Ress
    Apr 7, 2021 at 16:40

1 Answer 1


You can set the "Image" column using Set-PnPListItem cmdlet like below:

Set-PnPListItem -List "Logo Universe" -Identity 3 -Values @{"Image" = "{'fileName':'Power Apps logo.jpg','serverRelativeUrl':'/sites/MySite/SiteAssets/Lists/dbc6f551-252b-462f-8002-c8f88d0d12d5/Power%20Apps%20logo.jpg'}"}

Where Image is internal name of column. You can get the internal name of your image column by following this article: How to find the Internal name of columns in SharePoint Online?


enter image description here

Reference: Add/Update image columns in SharePoint/Microsoft Lists using PnP PowerShell

  • 1
    Hi @Ress, did you try this? Is it working for you? Apr 8, 2021 at 5:09
  • I have a question, why is the serverRelativeUrl a link to an image already stored in the list? Is that a requirement, can I not use an outside image?
    – Ress
    Apr 8, 2021 at 8:04
  • I suppose I can upload the images prior to SharePoint. But that did work all I had to do was change the name of the column and the serverRelativeUrl. My column is actually called "Photos". Thanks!
    – Ress
    Apr 8, 2021 at 8:31
  • 1
    Yes, you need to upload the images to SharePoint (Site Assets or any other library as you want) & then pass image URL in serverRelativeUrl. And yes, above code was just an example. You have to change the list name, item ID, column name, etc. as per your requirements. Apr 8, 2021 at 8:48
  • 1
    Thank you for your help. Everything is working perfectly!
    – Ress
    Apr 8, 2021 at 9:40

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.