Skip to main content

Notifications

Power Automate - AI Builder
Suggested answer

Power Automate grabbing attachments from email account and placing them in a local drive errors

Like (1) ShareShare
ReportReport
Posted on 17 Sep 2024 22:04:39 by 52
Hopefully this is an easy one for you guys. But the flow is to monitor emails in the inbox folder.
Whenever a new email comes through, if it has an attachment, it will take that attachment and place it in a folder on a local shared drive under a specific naming convention.

Where I'm getting stuck at is how to do the condition aka check if the email has an attachment or not.

Trigger is When a new email arrives in a shared mailbox (V2). Parameters in the trigger is "Include attachments" = yes and "Folder" = inbox.
The condition is what I have so far: 
length(triggerOutputs()?['body/Attachments']) greater than 0.

I get the error below. Not sure what else to do here. 


Categories:
  • sdrakedrake Profile Picture
    sdrakedrake 52 on 18 Sep 2024 at 13:35:00
    Power Automate grabbing attachments from email account and placing them in a local drive errors
    Ok im going to make this a lot less complicated.
    New flow is as follows:

    Trigger - When a new email arrives in a shared mailbox (V2)
                   Parameters - Only With Attachments and Include Attachments = Yes

    Step 2 - Apply To Each 
                  Parameters - Select an output from previous steps* - Attachments

    Step 3 - Create a file (File System SINCE its on a share Drive)

    The current error is 

    Action 'Create_file' failed: Key 'gateway' not found in connection profile.

    So im assuming this error is being caused by some connection issue. Googling trying to figure this out, but point is, I think I have the Condition error resolved. This new error is from the File System action.


  • sdrakedrake Profile Picture
    sdrakedrake 52 on 18 Sep 2024 at 12:02:11
    Power Automate grabbing attachments from email account and placing them in a local drive errors
    @flMike 

    Currently there isn't an input for the apply to each. Below is the screenshot. It only says "Select an output from previous step" for the parameter.

    Let me try and type it out as it might be easier to follow:
    Step 1: Trigger - When a new email arrives in a shared mailbox (V2)

                              Parameters: Include attachments_Yes

                                                  Folders_Inbox

    Step 2: Initialize Variable - Name: EmailAttachments

                                               Type: Array

                                               Value: Blank

    Step 3: Compose - Inputs: EmailAttachments (from initialize variable)



    Step 4: Condition - 
    Condition expression

    length(variables('EmailAttachments'))
    is greater than
    0


    Step 5: True - Apply to Each - EmailAttachments (from initialize variable) 

    Step 6: Compose (where im trying to do the naming convention)

    Step 7: Create file

    Step8: Move Email







  • Suggested answer
    FLMike Profile Picture
    FLMike 27,286 on 18 Sep 2024 at 05:44:18
    Power Automate grabbing attachments from email account and placing them in a local drive errors
    Hi
     
    Sorry I am not following.
     
    What is the Input to the Apply to Each. It cannot be a Number, so its not the length of anything.
     
    Please do in and open the Apply to each. Look a the inputs and outputs it will explain why it didn't do anything.
     
    But what I would like to see specifically is the actual Expression you put in the Input for the Ate.
     
    Thanks,
     
     
  • sdrakedrake Profile Picture
    sdrakedrake 52 on 17 Sep 2024 at 23:13:34
    Power Automate grabbing attachments from email account and placing them in a local drive errors
    Ok think im getting closer:

    New screenshot shows that errors are gone. However its skipping the "apply to each part."
    ActionBranchingConditionNotSatisfied
    The execution of template action 'Apply_to_each' skipped: the branching condition for this action is not satisfied.

    I initialized the variable as an array.
    And condition is still: 
    length(variables('EmailAttachments')) is greater than 0..

    Apply to each is the email attachments from the variable. 






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

End of Year Newsletter…

End of Year Community Newsletter…

Tuesday Tip #12 Start your Super User…

Welcome to a brand new series, Tuesday Tips…

Tuesday Tip #11 New Opportunities…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 144,654

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,440

Leaderboard
Loading started