cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PowerUser19
Helper III
Helper III

Send Profile picture of selected manager in email

Hi there, I need to send profile picture of Manager in the email. I have Html text with a table and list of fields. Is it possible to get the profile picture of the manager to the email content (like a thumbnail in the body of the email and NOT as an attachment) 

Any help is highly appreciated! 


Authorising Manager Email : " &"" & UpdateRequestDropdown.Selected.'Authorising Manager'.Email &"" & "
" & "
Authorising Manager Title : " &"" & UpdateRequestDropdown.Selected.'Authorising Manager'.JobTitle &"" & "
" & "
Authorising Manager Division : " &"" & UpdateRequestDropdown.Selected.'Authorising Manager'.Department &"" & "
" & "
Authorising Manager Image : " &"" & UpdateRequestDropdown.Selected.'Authorising Manager'.Picture &"" & "
" & "
Authorising Manager Image : " &"" & Office365Users.UserPhotoV2( UpdateRequestDropdown.Selected.'Authorising Manager'.Email) &"" & "
"

 

==================================================================

 

The above code send the link for the image as below in the email:

Authorising Manager information:

Authorising Manager Name : XXXX XXXXX

Authorising Manager Email :XXXXX@t.com

Authorising Manager Title : Manager

Authorising Manager Division : Product Planning & Development

Authorising Manager Image : https://xxxxx/_layouts/15/UserPhoto.aspx?Size=L&AccountName=xxx.com

Authorising Manager Image : appres://blobmanager/d5be6112350a46f48d1724eddbb763f6/8

Authorising Manager Phone : +00000

Authorising Manager Pic : appres://blobmanager/d5be6112350a46f48d1724eddbb763f6/9

1 ACCEPTED SOLUTION

Accepted Solutions
victorcp
Super User
Super User

hmm... that's right, you are using it in a text or html text, right? I created my code in the 'onselect' of a button (a behaviour property) and the conversion to a json works there

 

victorcp_0-1663142638186.pngvictorcp_1-1663142674047.png

 

View solution in original post

17 REPLIES 17
victorcp
Super User
Super User

Hi,

If you are sending the email via PowerApps, you can attach the image and refer it in your html, like this:

Office365Outlook.SendEmailV2(
    User().Email,
    "test",
    "<p>My Photo: <img src='teste.png' style='height:20px;width:20px'</p>",
    {
        Attachments:
        {
            Name:"teste.png",
            ContentBytes:User().Image
        }
    }
)

If you are using Power Automate, you can get the manager picture, add it as an attachment and use it in your html, like this:

victorcp_1-1663066154447.png

victorcp_2-1663066196960.png

Both codes has the same output

PowerUser19
Helper III
Helper III

Hi @victorcp ,

Thanks for your response. I am trying to get it from O365 connection directly from PowerApps. I am not using PowerAutomate for this function in my app. Is this achievable without Power Automate? 

victorcp
Super User
Super User

Hi @PowerUser19,

I have updated the previous comment, in PowerApps you can use this:

Office365Outlook.SendEmailV2(
    User().Email, // To
    "test", // Subject
    "<p>My Photo: <img src='teste.png' style='height:20px;width:20px'</p>", // Body
    {
        Attachments:
        {
            Name:"teste.png",
            ContentBytes:User().Image // change it to the manager picture
        }
    }
)

I hope it helps 🙂

@victorcp , 
Thanks so much again! This code perfectly works for an attachment. As I mentioned in my original post, trying to get the image as a thumb nail within the body of the email without attachment. Is there any way to achieve that? 

victorcp
Super User
Super User

I don't know if you can do it without the attachment, because you will need to store the image in a diferent source

PowerUser19
Helper III
Helper III

Thank you @victorcp . Appreciate your time. I will research if there is a way to store the manager profile picture in an image within PowerApps and send it within the body of the email.

victorcp
Super User
Super User

Yes, it is possible and it is easier than I thought.

 

When powerapps get the image it converts it to base64 and you can refer it directly to your code like this:

Office365Outlook.SendEmailV2(
    User().Email,
    "test",
    "<p>My Photo: <img src='"& User().Image &"' style='height:20px;width:20px'</p>"
)

 

Thanks and I hope it helps 😄

Hi @victorcp ,

Thank you but I still get the below in the email with the above code. Am I missing something? Did it work for you? 

Manager Img: <="" p="" src="data&colon;image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIy

PowerUser19
Helper III
Helper III

@victorcp ,
I was able to achieve it by storing the selected record's picture in an image field. Passed the value of the image to a variable and used the variable to pass the image to the email. Below is the code:

Image property value : Office365Users.UserPhotoV2(UpdateRequestDropdown.Selected.'Authorising Manager'.Email)

Set(var_ApproverImg,JSON(ApprovingMgrImageUpdateReq.Image,IncludeBinaryData));

And pass the variable in the html text:

"<img src=" &var_ApproverImg&"width='50'"&"height='50'"& ">"
With the above I was able to get the thumb nail of the picture in the body of the email. Attaching the screenshot. 

 

Really appreciate your time and suggestions on this @victorcp .

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,727)