cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TravisS
Level: Powered On

Error sending images as email attachments, ContentBytes column expects a 'Blob' type

Afternoon, I'm running into an issue with trying to send photos as attachments from PowerApps. Before I unload everything, the error I'm getting is: "Incompatible Type. The 'ContentBytes' column in the data source you're updating expects a 'Blob' type and you're using a 'Image' type."

 

Now for my workflow...

 

I have a camera control with the following code for the OnSelect statement: 

UpdateContext({counter: counter+1}); Collect(localPictures, {photoCount: "pic" & counter & ".jpg", loadPhoto: camera.Photo, loadNumber: Value(insertLoadNumber.Text)})

Basically, I'm just saving the pictures to a collection called "localPictures" as they're taken.

 

Once the form has been completed, the collection (localPictures) is saved to a SQL database, this is the OnSelect statement:

Set(geoLat, Location.Latitude); Set(geoLong, Location.Longitude); Set(geoAlt, Location.Altitude); UpdateContext({cancelDisplay: Disabled}); Patch('[dbo].[pAppLoadVerification]',Defaults('[dbo].[pAppLoadVerification]'),{loadNumber:Value(insertLoadNumber.Text),loadSignature:signatureBox.Image,uLogin:userEmail,uFName:userFName, formNotes:extraNotes.Text, dateCreated: Now(), latitude: geoLat, longitude: geoLong, altitude: geoAlt}); Collect('[dbo].[pAppLoadPhotos]',localPictures); Navigate(insertSuccessful,ScreenTransition.Fade); Set(clearPenControl, false); Set(clearPenControl, true)

I've copied the entire statement to not leave anything out but everything unrelated to the post has had a strikethrough applied to it.

 

The application has a detail screen to view records from the SQL database, the pictures are loaded back into a gallery called "viewPhotoGallery", this is the code for the gallery's items property:

Filter('[dbo].[pAppLoadPhotos]', loadRecords.Selected.loadNumber = loadNumber)

 

On my detail screen, I have an icon to begin the email process, it opens a prompt to allow the user to input an email and performs a ClearCollect on the gallery and adds all items to the collection: "emailAttachments"

UpdateContext({DetailRectangleVisibleFlag:true}); ClearCollect(emailAttachments, AddColumns(viewPhotoGallery.AllItems, "ContentBytes", viewPhotoGallery.Selected.viewPhotos.Image, "'@odata.type'", ""))

This is where my error is orginating from.

 

Also, here is a snapshot of my collection "emailAttachments", in case it helps:

PowerAppCollectionEmailAttachments.PNG

 

If it's possible, I want to convert the type "Image" to "Blob" or if I have to, rework my workflow to enable me to send emails with image attachments.

 

I appreciate the assistance anybody can provide. Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
TravisS
Level: Powered On

Re: Error sending images as email attachments, ContentBytes column expects a 'Blob' type

Hi,

 

Thank you for replying. This topic has since been solved. The photos needed to be saved as varbinary in SQL rather than varchar (this was originally done so the data would load back faster & this was not discussed in the topic). My ClearCollect statement was changed as well, it was changed to:

ClearCollect(emailAttachments, AddColumns(viewPhotoGallery.AllItems, "Name", photoCount, "ContentBytes", viewPhotos.Image, "'@odata.type'", ""))

I also needed to add a column for "Name" which I previously didn't have in my ClearCollect statement.

 

Thanks!

View solution in original post

3 REPLIES 3
Administrator
Administrator

Re: Error sending images as email attachments, ContentBytes column expects a 'Blob' type

Hi @TravisS I'm sorry to hear you're experiencing this issue. I will have my support team review this and an update will be provided within the thread. 

 

@TopShelf-MSFT

Highlighted
TravisS
Level: Powered On

Re: Error sending images as email attachments, ContentBytes column expects a 'Blob' type

Hi,

 

Thank you for replying. This topic has since been solved. The photos needed to be saved as varbinary in SQL rather than varchar (this was originally done so the data would load back faster & this was not discussed in the topic). My ClearCollect statement was changed as well, it was changed to:

ClearCollect(emailAttachments, AddColumns(viewPhotoGallery.AllItems, "Name", photoCount, "ContentBytes", viewPhotos.Image, "'@odata.type'", ""))

I also needed to add a column for "Name" which I previously didn't have in my ClearCollect statement.

 

Thanks!

View solution in original post

Administrator
Administrator

Re: Error sending images as email attachments, ContentBytes column expects a 'Blob' type

Thank you for the follow up and I'm glad to hear it's been solved.

 

@TopShelf-MSFT

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 254 members 4,496 guests
Please welcome our newest community members: