Hi,
I'm having trouble trying to send an outlook email with attachments from a sharepoint list. I have a button that when clicked sends out a message using Office365Outlook.SendEmailV2. I'm trying to use collections to gather the images:
ClearCollect(
PicCol,
LookUp(AreaPicturesV2, Area = AreaCombo.Selected.Area, Picture1),
LookUp(AreaPicturesV2, Area = AreaCombo.Selected.Area, Picture2),
LookUp(AreaPicturesV2, Area = AreaCombo.Selected.Area, Picture3),
LookUp(AreaPicturesV2, Area = AreaCombo.Selected.Area, Picture4),
LookUp(AreaPicturesV2, Area = AreaCombo.Selected.Area, Picture5)
);
The LookUp here goes into the sharepoint list, depending on the area selected, it'll put in the pictures of that selected area.
The images are saved as the image item in the list as a column, with me trying to get that image from the sharepoint and have it as an attachment in the email.
My train of thought is to create a collection with those images in it, then be able to have an attachment with that collection, however I am unable to figure out a way to perform this.
I fixed both issues, I guess the extension of the photos don't matter when sent.
Could you elaborate on using the extension from that file name? I am holding the images like this:
Also, another issue I found was that for the areas with less than 5 images, I would get an error saying that the attachment couldn't be null.
The reason they come up that way is because Outlook needs the extension to know what type of file it is looking at. You have to send the correct file extension with the file name. When you put the picture in the collection, didn't it come from the sharepoint file? Use the extension from that file name.
When I try it without the jpg, I get this:
Where when I download it, it says it's a File in type
It requires an attachment name, yes, but it shouldn't require that name to include 'jpg'... can't you use the original filename, or at least grab the file extension off it?
Okay, I followed the instructions from the link, but am now having another issue.
ClearCollect(
PicCol, {Name: "Picture1.jpg", ContentBytes: Picture1_Image.Image,'@odata.type':""},
{Name: "Picture2.jpg", ContentBytes: Picture2_Image.Image,'@odata.type':""},
{Name: "Picture3.jpg", ContentBytes: Picture3_Image.Image,'@odata.type':""},
{Name: "Picture4.jpg", ContentBytes: Picture4_Image.Image,'@odata.type':""},
{Name: "Picture5.jpg", ContentBytes: Picture5_Image.Image,'@odata.type':""}
);
I needed to change the name to include the '.jpg' in order for the images to show in the email. However, I realized that not all the images in the SharePoint list was a jpg image, some being png. Is there a universal way for the images to just show as their type?
Maybe this other post on this topic can help?
Solved: send image via email - Power Platform Community (microsoft.com)
Obviously SendEmail() is deprecated... but you can get help for that here: Office 365 Outlook - Connectors | Microsoft Learn
WarrenBelz
146,658
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional