web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Getting Sharepoint ima...
Power Automate
Unanswered

Getting Sharepoint image and displaying in Word template

(0) ShareShare
ReportReport
Posted on by 111

Hi, I am having issue with my Flow where i cannot get my image from a SP list to display within the word document. It just outputs the string.

 

This is my flow below

  1. When an item is created
  2. Get the items
  3. Compose > Take the image from the SP List and put it into a Base64 string
  4. Output it within my Popuplate Microsoft Word Template 

Screenshot 2023-05-10 at 9.27.33 AM.png

This is where i put it into the Word template: 

 

Albertax_0-1683667875266.png

 

This is what my end result is - I get the base64 string under Contact details 

Albertax_1-1683667942016.png

 

Where as ideally i want the image from the Sharepoint list to output

Categories:
I have the same question (0)
  • HenWang Profile Picture
    Microsoft Employee on at

    Hi @Albertax ,

     

    If you are trying to get the image to display in your word template, you need the file content value to put inside this word template.

    Demo flow:

    HenWang_0-1683774236098.png

     

    1. you need to add an image control into your word template so that it can display the image:

    HenWang_1-1683774295430.png

     

    2. Send an HTTP request to SharePoint:

    HenWang_2-1683774338621.png

     

    Uri:

    _api/web/Lists/getByTitle('test')/items(@{triggerBody()?['ID']})?$select=image

     

    You can just copy and paste it in your flow, but please be noted that the image string after  "$select= " is actually the logic name of my image column in SP list, please change it according to your own image column name.

     

    3. Initialize variable:

    HenWang_3-1683774466093.png

     

    json(body('Send_an_HTTP_request_to_SharePoint')?['d']['Image'])['fileName']

     

    4. get file content using path

    HenWang_4-1683774504078.png

    Fiel path:

    /SiteAssets/Lists/List_id/@{variables('image name')}

    You can find the list id value in any flow run history, for example, you can find it in the input of your trigger:

    HenWang_5-1683774606831.png

     

    5. populate the word:

    HenWang_6-1683774644503.png

     

    Hope this can help.

     

    Best Regards,

    Hen Wang

  • Albertax Profile Picture
    111 on at

    @HenWang  Thank you for taking the time to do such a detailed explanation, and for your response.

     

    I have been debugging this flow more most of morning, and am struggling to get past this step :

    Unable to process template language expressions in action 'Initialize_variable' inputs at line '0' and column '0': 'The template language expression 'json(json(body('Send_an_HTTP_request_to_SharePoint')?['ID']['Images'])['fileName'])' cannot be evaluated because property 'Images' cannot be selected. Please see https://aka.ms/logicexpressions for usage details.'.

     

    Any ides?

     

    Screenshot 2023-05-12 at 11.11.36 AM.png

  • HenWang Profile Picture
    Microsoft Employee on at

    Hi @Albertax ,

     

    After checking, you will need to use "Image" instead of "Images" in the json expression from your side.

     

    Also, please delete the first json in your expression.

     

    This is your expression:

    json(json(body('Send_an_HTTP_request_to_SharePoint')?['ID']['Images'])['fileName'])

     

    And below is the correct expression that you can directly copy and paste in your flow:

    json(body('Send_an_HTTP_request_to_SharePoint')?['d']['Image'])['fileName']

     

  • Albertax Profile Picture
    111 on at

    Thanks again for your reply, I am getting back an error:

    The image is not of type PNG or JPG. Please provide an image of type PNG or JPG.
    clientRequestId: 5eae9a7f-6de2-4499-a587-545e3c64192b

     

    I have attempted to change the variable to Object, as suggested in another post. To no luck. And i've also attempted to see where i output the variable to only grab the first, and it doesn't seem to do anything.

     

    I'm at a loss here. Should I be converting the image to a base64 image? 

  • HenWang Profile Picture
    Microsoft Employee on at

    Hi @Albertax ,

     

    For this error, do you have the image column in your sharepoint list?

     

    According to the error, it seems that the image you write into the list is not with type PNG or JPG. Maybe you can check the above two points to further decide what is next step for you.

     

    By the way, which action get failed in your flow? is it the initialize variable action?

     

    Best Regards,

    Hen Wang

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard