Power Automate save email attachment to SharePoint

Do you want to save email attachments to SharePoint using Power Automate Automate? This Power Automate tutorial will show us how to save email attachments to SharePoint in Power Automate.

Also, we will cover how to save email attachments to SharePoint with a different name using Power Automate. Finally, we will save only PDF attachments to SharePoint using Power Automate.

Power Automate save email attachment to SharePoint

Here we will see how to save email attachments to the SharePoint document library using Power Automate.

For example, we receive ‘Resume attachments’ in the company Outlook email address every day, and I want to automatically save those attachments to the Resume document library in SharePoint.

power automate save email attachment to sharepoint

To do this in Power Automate I have followed the below steps:

1. Open Power Automate Cloud, create an Automated Cloud flow, and then select a trigger action as ‘When a new email arrives (V3)’ action. Then provide the below information:

  • Folder: Select Inbox from the option
  • Include Attachments: Select the Yes option
  • Only with Attachments: Select the Yes option.
power automate save email attachment to sharepoint

2. Now we will get email attachments, for this, click on the +New step -> select Get attachments(V2) action. Then provide the below information:

  • Message Id: Select Message ID from dynamic content. This will automatically apply to each action.
  • Attachment id: Select Attachment attachment id from dynamic content.
power automate save attachment to sharepoint

3. Finally, we will save email attachments in the SharePoint document library, for this click on the +New step -> select Create file action. Then provide the below information:

  • Site address: Provide the SharePoint site address.
  • Folder path: Select the Folder path from dynamic content.
  • File name: Select the file name from dynamic content.
  • File content: Select the content bytes from dynamic content.
save email attachment to sharepoint power automate

4. Now save the flow and run the flow manually, then send an email to the Outlook inbox.

power automate get attachment from email and save to sharepoint

You can see the above email attachments are saved in the SharePoint document library

save my email attachments to a sharepoint document library

This is how to get attachments from email and save to the SharePoint document library using Power Automate.

See also  Open SharePoint list in Excel + Update SharePoint List from Excel using Power Automate

Power Automate save email attachments to SharePoint with a different name

Here we will see how to save email attachments to SharePoint with a different name using Power Automate.

For example, whenever a client sends project-related documents via email, I want to automatically save these attachments to the SharePoint document library named “Project Documents” with a new name that includes the original attachment name and today’s date.

save email attachments to sharepoint power automate

To save email attachments to SharePoint with a different name follow the below steps using Power Automate.

1. Open Power Automate Cloud, create an Automated Cloud flow and then select a trigger action as ‘When a new email arrives (V3)’ action. Then provide the below information:

  • Folder: Select Inbox from the option
  • Include Attachments: Select the Yes option.
  • Only with Attachments: Select the Yes option.
power automate save email attachment to sharepoint

2. Next, initialize two variables for the Attachment name and today’s date. for this click on the +New step -> select Initialize variable. Then provide the below information:

NameTypevalue
Attachment nameString
Todays dateStringformatDateTime(utcNow(),’yyyy-MM-dd’)
power automate email attachment to sharepoint

3. To get the attachment from an email, click on the +New step -> select Get attachment(V2) action. Then provide the below information:

  • Message-Id: Select Message ID from dynamic content. This will automatically apply to each action which will loop through messages.
  • Attachment id: Select Attachment attachment id from dynamic content. this will add another Apply to each action that will loop through attachments.
power automate save email attachment

4. To get the attachment or file name, for this, click on the +New step -> select Compose action. Provide the below information:

  • Inputs: Provide the below expression:
first(split(outputs('Get_Attachment_(V2)')?['body/name'], '.'))
save attachment from email to sharepoint power automate

5. To get the attachment extension, click on the +New step -> select Compose action -> provide the below information:

  • Inputs: Provide the below expression:
last(split(outputs('Get_Attachment_(V2)')?['body/name'], '.'))
How to save attachment from email to sharepoint power automate

6. Next, we will combine filename, today’s date, and extension to create a new file name, for this click on the +New step -> select Set variable action. Then provide the below information:

  • Name: Select the Attachment name from the dropdown.
  • Value: Provide the below expression:
concat(outputs('Compose'), '-', variables('Date'), '.', outputs('Compose_1'))
power automate get email attachment to sharepoint

7. To save email attachments to SharePoint with different names, click on the +New step -> select Create file action, and then provide the below information:

  • Site address: Provide the SharePoint site address
  • Folder path: Provide the folder path
  • File name: Select the Attachment name variable from dynamic content.
  • File content: Select content bytes from dynamic content.
power automate save email attachment to sharepoint with different name

8. Now save the flow and run the flow manually. Then send an email to the Outlook inbox.

send email attachment to sharepoint folder

You can flow runs successfully and the email attachment is saved to SharePoint with a different name.

send email attachment to sharepoint folder using Power Automate

This is how to save email attachments to SharePoint with different names using Power Automate.

See also  List variables in Power Automate Desktop

Power Automate saves only PDF attachments

Here we will see how to save only PDF attachments to the SharePoint document library using Power Automate.

when an employee submits an expense reimbursement document via email, requesting reimbursement, the attachments will be automatically saved in the Expense Reimbursement Document Library in SharePoint.Additionally, a condition is applied to ensure that the document is in PDF format.

save my email attachments to a sharepoint document library

To do this using Power Automate follow the below steps:

1. Open Power Automate Cloud, create an Automated Cloud flow, and then select a trigger action as ‘When a new email arrives (V3)’ action. Then provide the below information:

  • Folder: Select Inbox from the option
  • Include Attachments: Select the Yes option.
  • Only with Attachments: Select the Yes option.
power automate save email attachment to sharepoint

2. Next, we will check the attachment type, for this click on the +New step -> select Condition action. Provide the below information:

  • Choose a value: Select the Attachment name from dynamic content. This will Apply to each action to the flow.
  • Operator: Select the operator as ‘contains’ from the option
  • Choose a value: Write the value as .pdf
power automate copy attachment to sharepoint

3. If the condition is true, then we will get an attachment from the email, for this, click on the +New step -> select Get attachment (v2) action.

Provide the below information

  • Message Id: Select Message ID from dynamic content.
  • Attachment id: Select Attachment attachment id from dynamic content. This will add another Apply to each action that will loop through attachments.
power automate save only pdf attachments

4. To save only PDF attachments in the SharePoint document library, for this, click on the +New steps -> select Create file action. Provide the below information:

  • Site address: Provide the SharePoint site address
  • Folder path: Provide the folder path
  • File name: Select the Attachment name variable from dynamic content.
  • File content: Select content bytes from dynamic content.
power automate attachment to sharepoint

5. Now save the flow and run the flow manually. Then send an email to the Outlook inbox to trigger the flow.

power automate save attachment from email to sharepoint

You can flow runs successfully and the email attachment is saved to SharePoint with a different name.

See also  How to format a number as currency in Power Automate?
power automate save email attachment to sharepoint

This is how to save only PDF attachments to the SharePoint library using Power Automate.

Conclusion

In this Power Automate tutorial, I have explained how to save email attachments to SharePoint using Power Automate. This tutorial will help you to get attachments from email and save to the sharepoint document library using Power Automate. Also, it covers:

  • Power Automate save email attachments to SharePoint with a different name
  • Save email attachment to SharePoint in Power Automate.
  • Power Automate save only PDF attachments

You may also like:

  • Hi sir
    Is there a way to upload pdf documents from local to multiple share point lists based on ID

  • Thank you Bijay! I have a question – we have an email called accounting to which all our vendors send thier invoices to. I need all attachments that are sent to that email to be saved to Sharepoint. So instead of from email address do I use to email address?

  • I cannot wrap my head around this particular flow. Why does it need IsFromFilterApplied condition? Cannot I just specify “from” e-mail address in trigger if I want this flow to save attachments from mails from particular person? What’s the difference?

  • Hi Bijay,
    Thank you for these lessons..really appreciated it.
    I have tried one of the flows to save and rename the file in the share point whenever a new email attachment comes to the inbox. But unfortunately, I am getting the error, It’s creating duplicate files, actual files and files with date …. How to resolve this?

  • Hi Bijay.
    Great tutorial. I am new to powerflow. I want to get mail attachment(s) of type excel table and extract data to share point list. Is it even possible achieve in one or two flows.
    Best regards.

  • Hello,

    Can you confirm me is there a way to upload images directly from FTP server to a sharepoint online library/folder.

  • We have created a flow to download email attachments on every email arrival. Do we need to schedule or Automate this flow ?

  • Hello Bijay Kumar !!! How are you? See if you can help me. I receive emails from some suppliers that send XML files as an attachment within an attachment. As if they were forwarding the message. I currently use powershell to download and script to extract the XML from within the messages (Extension .msg). I just need to download these MSG-type attachments. I even created a flow, but the messages get smaller. For example, a 106KB file becomes 60KB in size

  • >