0

I have the following image in a SharePoint library:

enter image description here

I wish to insert this image into an Image Column as part of the metadata of a List called QSAR Analysis Data.

enter image description here

TEST Flow to try and achieve this I run into all sorts of errors:

Based on: Add an image to SharePoint Image columns using Power Automate.

enter image description here

Note, the title should really say TEST but this is an old screenshot and for testing I don't mind which item the image were to join.

However I get the following error:

The property '__metadata' does not exist on type 'SP.Data.QSAR_x0020_Analysis_x0020_DataListItem'. Make sure to only use property names that are defined by the type.
clientRequestId: 87870979-e145-4342-86c3-093dbbf32f26
serviceRequestId: d4e810a1-5019-8000-54bf-d6b1c5f76cb2

Removing this I then get another error:

The property 'type' does not exist on type 'SP.Data.QSAR_x0020_Analysis_x0020_DataListItem'. Make sure to only use property names that are defined by the type.
clientRequestId: 10825d98-ac88-419a-a5c0-10123d487802
serviceRequestId: 0fe910a1-f029-8000-2b56-b40b4ec74d91

Removing this line gives me:

{
    "Title": "TEST",
    "Image": {
        "type": "thumbnail",
        "fileName": "TEST.png",
        "fieldName": "Image",
        "serverUrl": "https://xxx.sharepoint.com/",
        "serverRelativeUrl": "/sites/xxx/ImageTest/Images/TEST.png"
    }
}

But running this I get the following error:

An unexpected 'StartObject' node was found when reading from the JSON reader. A 'PrimitiveValue' node was expected.
clientRequestId: e6590f4e-1a8a-4256-a6ac-8fc26a3bf1e6
serviceRequestId: 24e910a1-503d-8000-3403-c857782bfc69

So I'm clearly just digging myself a hole.

1

1 Answer 1

1

You are passing value for ImageColumnName in Body as object type. Instead, you have to pass the "object" in the form of String type.

Check the value for Body parameter in this blog carefully: Add an image to SharePoint Image columns using Power Automate. It should be in this format:

{
    "Title": "Power Automate",
    "ImageColumnName": "{\"type\":\"thumbnail\",\"fileName\":\"power-automate.png\",\"fieldName\":\"ImageColumnName\",\"serverUrl\":\"https://contoso.sharepoint.com\",\"serverRelativeUrl\":\"/sites/SPConnect/SiteAssets/Lists/dbc6f551-252b-462f-8002-c8f88d0d12d5/power-automate.png\"}"
}

You should also pass the UniqueID metadata of image file as value for id property inside the image column value so that it will show the images properly in Power Apps as well (if you connect your list to Power app). Check the value passed to image column at as reference: Add/Update image columns in SharePoint/Microsoft Lists using PnP PowerShell.

Example:

{
    "Title": "Power Automate",
    "ImageColumnName": "{\"type\":\"thumbnail\",\"id\":\"abcde-fghij-1234-xxxx\",\"fileName\":\"power-automate.png\",\"fieldName\":\"ImageColumnName\",\"serverUrl\":\"https://contoso.sharepoint.com\",\"serverRelativeUrl\":\"/sites/SPConnect/SiteAssets/Lists/dbc6f551-252b-462f-8002-c8f88d0d12d5/power-automate.png\"}"
}

You may need to use Get file metadata or Get file properties after your create file action --> You will get UniqueID from the action outputs --> Pass it to id property inside the data you passed for image column value.

1
  • Hi again just seen you addition with the UniqueId (I just see id? not unique id). The flow runs successfully with the id section added however in power apps I get an error when I add this I get: Error when trying to retrieve data from the network. Any thoughts?
    – Nick
    Commented Mar 13 at 14:37

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.