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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Display BannerImageUrl...
Power Automate
Answered

Display BannerImageUrl to Outlook Mail if "?guidSite"

(0) ShareShare
ReportReport
Posted on by 2

Hi everyone,

I am using powerautomate to automate a process of collecting some news from sharepoint for an email newsletter, but I am experiencing problems displaying the preview images associated with those news.

 

Basically, I am first using the action "Send an HTTP request to SharePoint" which retrieves the different information from the news including the one related to ['BannerImageUrl']?['Url'] ... To display the image I understood that there are known issues that require the workaround of fetching such images in base64 format and then displaying them. And so far so good.

 

The issue is that such a workaround I can only follow if the image retrieved from the action is in the format

https://xxxx.sharepoint.com/_layouts/15/getpreview.ashx?path=%2Fxxxx%2Fxxxxs%2Fxxxx%2Fxxxxx%2Fxxxx.jpeg

In some circumstances, however, the image is returned, for reasons I do not understand, in the format

https://xxxx.sharepoint.com/_layouts/15/getpreview.ashx?guidSite=xxxxx&guidWeb=xxxxxx&guidFile=xxxxx&ext=jpeg

 

My questions are:
1) Why is the url sometimes returned one way rather than the other?
2) How can I get the image to show up in the email from the second format (the one with guidSite...)?

 

I noticed that the question has been asked a few times in a such way, but I have not found a working answer.

 

Thanks in advance

Categories:
I have the same question (0)
  • Andrew_J Profile Picture
    1,962 Moderator on at
  • Verified answer
    Ellis Karim Profile Picture
    12,103 Super User 2026 Season 1 on at

    Hi @LukeRedd ,

     

    Here is something you can try. It's from an old flow I had made back in 2021.

     

    We need to get following details about the image

    • Content type: tells the browser what kind of file or content is being used so it can handle it correctly.
    • Content: the content of the image in base64 format

    Then embed the image into HTML using the <img> tag:

    Snag_4149043.png

     

    For the newsletter,  we you could apply some styling:

    Snag_4158532.png

    The styling width:100%; height:100% and object-fit:cover is used to ensure that the image fills its container while maintaining its aspect ratio and cropping if necessary:

    Snag_43c523e.png

    Send an HTTP request to SharePoint

    Snag_41ab4f5.png

    Snag_41e7bff.png

     

    Compose HostName:
    concat('https://', uriHost(outputs('Compose_BannerImage_URL')))
    
    Compose URIPathAndQuery
    uriPathAndQuery(outputs('Compose_BannerImage_URL'))
    
    Uri for Send an HTTP request to SharePoint
    substring(outputs('Compose_URIPathAndQuery'),1)

     

    Get image content-type and content

    Snag_41822e0.png

     

    Compose Body:
    outputs('Send_an_HTTP_request_to_SharePoint')?['body']
    
    Compose content-type:
    outputs('Send_an_HTTP_request_to_SharePoint')?['body']['$content-type']
    
    Compose content
    outputs('Send_an_HTTP_request_to_SharePoint')?['body']['$content']

     

    Prepare the HTML img Tag

    Snag_418699d.png

     

    data:[outputs('Compose_content-type')];base64,[outputs('Compose_content')]

     

    Example of the news body HTML showing where the image is embedded:

     

    <img alt="" width="100%" height="100%" src="data:[content-type];base64,[content]" style="object-fit:cover;">
    

     

    Snag_418e3ce.png

    If the HTTP request to SharePoint fails

    Remember to handle the situation where the HTTP request to SharePoint could fail, for exampe:

    Untitled Diagram.jpg

     

    Hope this helps.

     


    Ellis
    ____________________________________
    If I have answered your question, please mark the post as ☑️ Solved.
    If you like my response, please give it a Thumbs Up.
    My Blog Site

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 378

#2
Valantis Profile Picture

Valantis 329

#3
David_MA Profile Picture

David_MA 283 Super User 2026 Season 1

Last 30 days Overall leaderboard