Bulk update Image column of SharePoint to a specific Image – using Power Automate – Part 2

Hello everyone and welcome to my blog. I am back with another blog on SharePoint and Power Automate flow.

This post is a continuation of my previous post where I went through in detail on how to clear the value of image column of SharePoint through a Power Automate flow. We also saw how we can use that feature to bulk update the image column of SharePoint list to null value.

In this blog, I will do the reverse. I will go ahead and upload an image in the Image column using Power Automate. Please note that this entire post concerns with the Image column type of SharePoint list and not the Picture column with which it is frequently confused.

Let’s get started with a requirement. I have created a SharePoint list with an Image column – Report Thumbnail

I want to update the report thumbnail for all the three items to a single image. If you have followed my previous blog, you know that Image columns do not show up in Bulk edit screen. You have to update each item individually.

While that is OK for few records, things become complicated as the number of records keeps on increasing. So let’s see how we can perform bulk upload on Image column of SharePoint list.

Before we proceed further, we should first understand how SharePoint stores the data of the Image column. Quite unknown to many, SharePoint uses the ‘Site Assets‘ document library for this purpose. Let’s explore it further.

Let’s verify this. Navigate to your list settings and then get the List ID.

From the URL I take my list ID which is – 3e65103c-6646-4745-9544-6db29284a7df

I then navigate to Site Contents -> Site Assests -> Lists -> <List ID folder>. Follow the below screenshots.

As you can see there are currently no items inside the folder. Let’s go ahead and update the image column of a list item record. Check out the below video to observe what happens when we do it.

So whenever we upload an image in the Image column, the image is stored inside the Site Assets -> Lists -> <List ID folder>

It’s now quite clear that to update the image column of the record, we will first need to create the image in this folder and then link the item to the Image column. But how to link it?

To understand, let’s first check what we get when we query the Image column for a list item record. I used the REST API endpoint to query a record and below is the results returned. Check for the highlighted part which contains the value for the image column.

I take out only the value of Report Thumbnail which is my image column and below is the value.

<d:ReportThumbnail>
      {
         "type":"thumbnail",
         "fileName":"Portal_thumbnail_it.jpg",
         "nativeFile":{},
         "fieldName":"ReportThumbnail",
         "serverUrl":"https://aibuilderdd.sharepoint.com",
         "fieldId":"99e04a38-3777-4cd9-8649-232f67eb4024",
         "serverRelativeUrl":"/SiteAssets/Lists/3e65103c-6646-4745-9544-6db29284a7df/Portal_thumbnail_it.jpg","id":"ae277496-6ff6-42a5-a122-1a9309585de7"
       }
   </d:ReportThumbnail>

By now I think it is quite clear on how you can update this column value. Step 1 is to upload the image in the folder path discussed earlier. And then update the column to link to the specific folder item. So let’s get started with designing the Power Automate flow.

I create a flow with Manual trigger. For the demo, I kept the image in one-drive for business location. I am reading the file using One Drive for business connector.

In the next step I retrieve all the Items from my SharePoint list which I want to update. You can put your own filters here to filter out the results. For this I used the Get Items connector of SharePoint.

Now comes the most important part. I use Apply to Each to iterate through all the items. I used the Create SharePoint File action to create the file in the Site Assets -> Lists -> <ListID> folder.

The file name I have made dynamic by using the guid() function in file path. However it is not mandatory to use the guid() function. You can use other techniques to make the file name mandatory.

Now it’s time to prepare the input for the Image column. For this I use the Compose action where I provided JSON in the below format. It’s the same format which the Image column expect.

There are few fields which are dynamic here. And it’s pretty easy to map them.

  • fileName – Display name of the file from the Create SharePoint file action
  • serverRelativeURL – File path output from Create SharePoint file action.
  • id – random guid value. Used the guid function of Power Automate.

We have uploaded the file. The field JSON input is ready. Now it’s time to update the image column with the value in the Compose action.

This is going to be very similar to the what I explained in my earlier blog. Here also we use the ‘Send an HTTP request to SharePoint‘ connector. Check for the below screenshot to configure your action accordingly.

That’s it. Now when I run the flow, it would update the image column of the list item records to the image in One Drive.

Hope you liked the post. If this post has helped you, you can buy me a coffee, links on the right side panel.

You will also like the below posts.

Debajit Dutta
Business Solutions MVP


Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe to get the latest posts sent to your email.

1 thought on “Bulk update Image column of SharePoint to a specific Image – using Power Automate – Part 2”

  1. Pingback: Bulk update Image column of SharePoint list - using Power Automate - Part 1 - Debajit's Power Apps & Dynamics 365 Blog

Comments are closed.

Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading