Skip to main content

Notifications

Power Automate - Building Flows
Answered

Send http request to SharePoint - "Unexpected character..." error

Posted on by

Hi,

I'm attempting to add an image to a SharePoint image column using "Send an HTTP request to SharePoint" in my flow (image below). The flow runs and reports as successful, however the image doesn't get added to the column and when I check the flow results I can see an error in the Outputs - "ErrorMessage": "Unexpected character encountered while parsing value: h. Path '', line 0, position 0."

 

I'm not sure where the error is occurring. I've tried using different images from different places, but other than that I'm not sure what else to try to fix it. Is anyone able to help me pinpoint where the error is happening?

 

_nerdy_0-1629869699981.png

The error message is in the Outputs section of the flow run monitor. Here is the everything in that section:

 

{
 "d": {
 "ValidateUpdateListItem": {
 "__metadata": {
 "type": "Collection(SP.ListItemFormUpdateValue)"
 },
 "results": [
 {
 "ErrorCode": 0,
 "ErrorMessage": "Unexpected character encountered while parsing value: h. Path '', line 0, position 0.",
 "FieldName": "ImageRep",
 "FieldValue": "https://xxx.sharepoint.com/sites/O365_BRA_50030345/ScIDResources/1/thumbnail.jpg",
 "HasException": true,
 "ItemId": 1
 }
 ]
 }
 }
}

 

 

 

  • Re: Send http request to SharePoint - "Unexpected character..." error

    Thanks @Expiscornovus,

    I really appreciate your reply and it has helped. I've run some tests and it is working for me. 

    The broader flow that I'm working on will upon creation of a new item in a SP list:

    1. get the first attachment (usually a PDF or Word doc)
    2. copy that to a SP document library (just to get SP to generate a thumbnail)
    3. then upload the thumbnail to that library as a file (the dynamic URL for SP doc library thumbnails doesn't seem to work in the Send HTTP request body)
    4. then copy that file back into the image (or thumbnail) column of the original list item.

    That may sound like an odd flow, and I'm open to other suggestions, but I'm working around a few constraints and this is where I've landed. Thanks again for your help.

  • Verified answer
    Expiscornovus Profile Picture
    Expiscornovus 30,706 on at
    Re: Send http request to SharePoint - "Unexpected character..." error

    Hi @_nerdy,

     

    The new image column (thumbnail data type) requires you to upload a file. This is the reason why it is expecting a bit more in the field value. Are you using that column?

     

    If so, you have two options. One upload it and use a different body in the request. The other option is to use the hyperlink or picture column instead.

     

    For the thumbnail type column you could use json body like in the example below.

     

     

    {"formValues":[{"FieldName":"ImageRep","FieldValue":"{\"type\":\"thumbnail\",\"fileName\":\"test.png\",\"nativeFile\":{},\"fieldName\":\"ImageRep\",\"serverUrl\":\"https://contoso.sharepoint.com\",\"serverRelativeUrl\":\"/sites/Test/SiteAssets/Lists/0185dc60-488d-489c-b52b-5aeb3372b7cb/test.png\",\"id\":\"943cd58e-e2c1-4e08-8d1a-dbca646d7359\"}","HasException":false,"ErrorMessage":null},{"FieldName":"ContentTypeId","FieldValue":"0x0100A0FE8CB63079B347A3728B16B059B2C6006995CAE06D28294FB524C01F1C7481C4","HasException":false,"ErrorMessage":null}],"bNewDocumentUpdate":true,"checkInComment":null}

     

     

    thumbnailcolumn.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,591

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,090

Leaderboard