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
Solved! Go to Solution.
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
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:
Both codes has the same output
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?
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?
I don't know if you can do it without the attachment, because you will need to store the image in a diferent source
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.
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:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIy
@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 .
User | Count |
---|---|
124 | |
87 | |
86 | |
75 | |
69 |
User | Count |
---|---|
214 | |
181 | |
140 | |
96 | |
83 |