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 Apps / Get specific file from...
Power Apps
Unanswered

Get specific file from Onedrive Business and add file as attachment on outlook.

(0) ShareShare
ReportReport
Posted on by 566
Hello, 
 
I need to get a specific file from Onedrive from my Power app and send it as attachment By Outlook Email.
I know it's filename but need to get the full path of this file and send it as attachment by email.
 
Here is my current function i use to send email:
 
Office365Outlook.SendEmailV2(MAILDESTINATION;"This is my file:";{From: MYMAIL;Attachments: [
{Name:"MYFILE.PDF";ContentBytes:PDF(MYFILETEST)};]})
Any suggestion?
 
In the case if working with onedrive files is more complicated that sharepoint , i can also upload these files to sharepoint. In this case please suggest me another suggestion.
Thank you
Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at
    Firstly, you are going to need to do this in Power Automate as the actual Content of either option (OneDrive or SharePoint) is not available directly in Power Apps. Also, if using OneDrive, this is accessed in the context of the Logged-in user (so it will see their OneDrive), so in the Flow, you would need to configure the Run only users to use your connection. SharePoint is a much better idea here (you can simply send the Identifier, grab the content and add to the email).
     
    The PDF however produces another challenge as you will need a Premium Connector (Adobe one example) to PDF the content of the file.
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn   
     
     
  • Sormick Profile Picture
    566 on at
     
    Thank you so much for your reply.
     
    I'm an business user.
    Please note that the file is already in PDF format. Do not need to convert it. just need to send this file as email attachment.
    With my current understanding of Power automate i think i will know how to get the File ID but don't know how retrieve it on power automate.
    For sure if sharepoint is easier than onedrive, so these files will be store on a sharepoint folder.
    Just need to know after getting the file ID how to get this file using the Office365Outlook.SendEmailV2 function.
  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at
    Flow is below - you need to send the file Identifier which is available if you connect the Library as a data source.
     
  • Sormick Profile Picture
    566 on at
    Dear @ ,
     
    Thank you as always for your reply but i would rather prefer to use the  Office365Outlook.SendEmailV2 function in power apps instead of using the Send an email V2 element on power automate because i have some restrictions on my automate about with some emails.
     
    I managed to save these files to a sharepoint list as attachments. (One attached file per element) 
    Maybe it would be easier to get the attached files to be sent by email?
     
    Is there a power apps function to retrieve the attached file of my sharepoint list?
  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at
    Yes, you can send attachments to an email directly from Power Apps - I have a blog on this that adds some other options as well.
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn   
  • Sormick Profile Picture
    566 on at
    Sorry I'm a newbie with some power apps formulas.
     
    I jist need to get the file which is stored in the first element of my sharepoint list.
    Not sure if i need to create a Galery or Datatble to retrieve my attachment.
    I tested with this formula with no success:
    Please note that i have a french version of Power apps, this is why the formula is a little different than the english one.
     
    Office365Outlook.SendEmailV2((
       "xxx@yyy.com";
       "Sujet de l'e-mail";
       "Veuillez trouver ci-joint les fichiers sélectionnés.";
    
       
       {
          'Pièces jointes_Colonne3': 
          RenameColumns((
             Filter(
                Gallery1.AllItems;
               First(Gallery1.Selected.'Pièces jointes').Value
             );
             "Value"; "ContentBytes"
          )
       }
    )
     
  • Verified answer
    WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at
    Assuming you want the first attachment from the record selected in your Gallery​​​​​​.
    Office365Outlook.SendEmailV2(
       "xxx@yyy.com";
       "Sujet de l'e-mail";
       "Veuillez trouver ci-joint les fichiers sélectionnés.";
       {
          Attachments:
          {
             Name: First(Gallery1.Selected.Attachments).DisplayName;
             ContentBytes: First(Gallery1.Selected.Attachments).Value
          }
       }
    )
    I do not know if the French version has a different field name for Attachments field, but this is the English version. The field name you supplied seems to translate to 'Attachments_Column3', which I do not think is correct (there is only one Attachment column in a SharePoint List)
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn   
  • Suggested answer
    Sormick Profile Picture
    566 on at
    Thank you @WarrenBelz !
     
    Please find below the final formula which worked perfectly for me:
    Office365Outlook.SendEmailV2(
       "xxx@yyy.com";
       "Sujet de l'e-mail";
       "Veuillez trouver ci-joint les fichiers sélectionnés.";
       {
          Attachments:
          {
             Name: First(Gallery1.Selected.'Pièces jointes').DisplayName;
             ContentBytes: varContenuBinaire
          }
       }
    )
     
    This formula sends by email the first attachment of my sharepoint Gallery
     
    Great support all!

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard