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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Flow Email Attachment ...
Power Automate
Unanswered

Flow Email Attachment Content as varbinary(max) parameter to stored procedure

(0) ShareShare
ReportReport
Posted on by 4

Hello,

Idea is Flow listens for emails and inserts attachments to a SQL Server FileStream filetable as such:

2019-05-26 16_41_29-Window.png

 

The stored proc executes with the following error: 

400 - Invalid binary encoding
 
This is the cleanest way for me to do the insert for each attachment but comes down what is the binary type sent? I 
 
Categories:
I have the same question (0)
  • v-yamao-msft Profile Picture
    on at

    Hi @Bukester ,

     

    FileSystem is not a datatype and is enabled as an attribute on a Varbinary (max) column.

     

    Please use the conversion functions to convert the value’s type to see if it will work:

    Base64ToBinrary

     

    Best regards,

    Mabel

     

  • Bukester Profile Picture
    4 on at

    Thanks Mabel! Do we agree that its the "Attachment Content" that is the file itself? The payload so-to-speak? It has to be. I'll try your suggestion and update the post. It would be great if it was. Otherwise, I'd have to copy to the directory presented by the FileTable, which is not so bad anyhow.

  • Bukester Profile Picture
    4 on at

     

    No luck. It still doesnt like the "Invalid binary encoding." I can also see that the stored procedure is never called, so Flow is not capable of constructing the RPC call at all. Its failing within flow. 

     

    https://powerusers.microsoft.com/t5/PowerApps-Ideas/Add-support-for-binary-data-types-in-SQL-Server-and-Azure-SQL-DB/idi-p/30178

     

    This is saying its available in PowerApps but not in Flow. But thats as of August 2018.

     

    2019-05-27 09_35_09-Window.png

  • v-yamao-msft Profile Picture
    on at

    Hi @Bukester ,

     

    Please try to input your function in the following way under Expression tab:

    1.PNG

     

    Best regards,

    Mabel

     

  • jeremartin Profile Picture
    2 on at

     

    I tried both base64ToBinary(ContentBytes) and base64ToBinary(body('Get_attachment')), but with the same error "Invalid binary encoding." I have a OneDrive Create File right before the Execute stored procedure (V2), and it successfully saves the attachment to the one drive folder. But the SQL component always gives a "Invalid binary encoding".    

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard