Jan 31 2024 12:16 AM
I have built a Flow for a customer, to allow users to submit a MS form with details of unwanted office equipment including a photo, which goes through an approval and then saves the item in a 'Stock Exchange' SharePoint list.
The flow works by using Create File to save the image into the Sites Assets/Lists/<ListGUID> document library, and then using Send an HTTP Request to SharePoint to create the list item referring to the image. I have a gallery view on the list which works fine if I manually add an item and include an image, if its saved by the flow it fails to display properly, it just gives the files name. The image is definitely present in the library with that name. If I change to normal list view it displays correctly. There just seems to be something missing for the gallery view, such as a generated thumbnail file for example, any suggestions?
See images below
Jan 31 2024 02:00 AM - edited Jan 31 2024 02:01 AM
Update:
I've just been exploring the Site Assets/Lists document library with PnP PowerShell and comparing a working image and a non working image.
Get-PnPListItem -List "Site Assets" -Id <item ID> | Select-Object -ExpandProperty FieldValues.
The only difference I can see is these 2 properties:
ImageMetadataListItemId 1
ImageMetadataListFieldId 63856ec5-d837-4d96-818d-9b595a0ea5a2
They are populated like shown for the working one, but blank for the other. Might be nothing but cant see any other difference.
I also tried the column formating from this article
https://lists.handsontek.net/format-image-column-preview-microsoft-lists-sharepoint/
The image immediately didnt display again. I can see the line
"src": "=getThumbnailImage(@currentField, 500, 500)"
Makes me think that there's a thumbnail image somewhere that's required, which the Flow isn't creating
Jan 31 2024 05:10 AM
@AndyTuke1325 First of all check the src property value used for img tag in the gallery view JSON formatting.
Previously Microsoft was storing the images saved in "image" column to Site Assets library for all lists. Recently they made some changes and sometimes images are saved to attachments section of same list if attachments are enabled on the list. Check more details at:
Also, while saving the image to list via Power Automate what is the body you are using? You have to pass the Unique ID column value of image from site assets library to image column in the list to get it working properly.
I have updated my blog (which uses PnP PowerShell) with this new update, check here: Add/Update image columns in SharePoint/Microsoft Lists using PnP PowerShell
I have some other solutions to add/update image columns in the SharePoint list using CLI for Microsoft 365 and Power Automate as well. But Power Automate blogs are older and need updated version accordingly to update the Unique ID properly. However you can refer them here if you want:
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.