Forum Discussion

Pn1995's avatar
Pn1995
Brass Contributor
Apr 08, 2019

Flow to extract attachments from Inbox

Hi

 

We have a Outlook Inbox that has a subfolder in this that contains lots of emails with attachments on them.

 

We want to be able to extract the attachment from these emails and save them into a folder.

 

We believe we can do this for new emails coming into the inbox using flow but anyone know if its possible to run flow or something else to extract the attachments that are already sitting in the email folder?

 

Thanks

  • No - the 'apply to each' required are automatically added by Flow when it detects that you are using an output that is an array - e.g. if you use an output from 'get emails' (rather than get email) - the action is automatically put inside a 'apply to each'.

    Basically, you Flow would need to look almost identical to mine, in terms of blocks, at least.

    Regarding the limit on number of emails it will get - I'm not sure, but it would be easy to test.

    If you do find there is a limit, you may need to move batches of emails into a folder, and run the Flow multiple times.
  • Lakshman_Kanth's avatar
    Lakshman_Kanth
    Copper Contributor

    Pn1995 

     

    We can use  Instant Flow --> When an email is flagged --> Save attachment  to One Drive folder.

     

    After creating flow select all mails and add flag then the flow will run:smile:

     

    I Did this one for 1500 mails 

     

     

    Thanks ,

    LK

    • ControllerFred's avatar
      ControllerFred
      Copper Contributor
      I am new to this process, can you help me set up the flow step by step?
      • j_cabanillas's avatar
        j_cabanillas
        Copper Contributor

        I like this flow and already using it but I need to have something more specific. 
        I want to extract the attachment but only certain files , like pdf file. I don't want images to get into my folder.

        Any idea on how to do that ?

  • Rob Ellis's avatar
    Rob Ellis
    Bronze Contributor
    A couple of quick ideas / options:

    1 - Create another new folder under Inbox, configure the Flow to run against that new folder, then move all the existing emails to the new folder - so the Flow triggers on them.

    2 - Create a Flow that is triggered manually (or on a schedule), and points at the folder - this Flow would need to have steps something like this:

    - Get items in folder that have attachments
    - For each, get the attachment and save it
    • Pn1995's avatar
      Pn1995
      Brass Contributor

      Thanks Rob Ellis

       

      I have been setting up your ideas, however it doesn't seam work.

       

      What seams to happen is that if I manually copy 1 email into the subfolder and then MANUALLY run the flow it will copy the attachment to a sharepoint or onedrive site

       

      However if I copy 2 or 3 email it and then manually run it will only copy the attachment from the "newest" email, it will ignore the other emails.

       

      It NEVER run automatically. 

       

      Attached are screen shots of what I have done - any ideas on how to get this working would be appreciated.

       

       

      • Rob Ellis's avatar
        Rob Ellis
        Bronze Contributor

        Pn1995 It is likely that the trigger does not occur when you move an existing email into the folder - try configuring an Outlook rule to move messages into that folder when received, then send a test email.

         

        For dealing with existing emails in the folder, my 2nd option would be the one to go for, I think.

         

        That would need to be triggered manually or on a schedule, and use the action 'get emails' (not 'get email' - because you want more than 1)

Resources