cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
New Member

Filter an array of attachements from a sharepoint list

Hello, I am trying to filter an array I have created to get the attachments from a SharePoint list.

What I am trying to do is make it so that when information is entered in the SharePoint list the flow will kick off and send the information from the list item in 3 separate emails. I have this working, the next step is to get the attachments and filter them by name to get attached to the emails. There should be two attachments to for each list item, both PDFs, one for Accounting and one for Insurance. The 3rd email is just a general email with some of the information from the list entry.

 

I have tried Filter Array, I cannot get it to return the results that I am looking for, it will still attached both items to the emails instead of the intended one for each email.

 

I followed this thread to get them both to attach to one email. https://flow.microsoft.com/en-us/blog/multiple-attachments-single-email/

 

Any help would be appreciated!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User II
Super User II

Hello @darevandy 

You could use a switch statement, with different paths according to the first 3 letters of the file name, for example. Have a look at this sample:

 

accounting.png

 

 

According to the first 3 letters of the attachment's filename, flow goes to Accounting or insurnance branches, using the following expression:

substring(items()?['Apply_to_each']?['DisplayName'],0,3)

 

Hope it helps!

Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!

View solution in original post

4 REPLIES 4
Super User II
Super User II

Hello @darevandy 

You could use a switch statement, with different paths according to the first 3 letters of the file name, for example. Have a look at this sample:

 

accounting.png

 

 

According to the first 3 letters of the attachment's filename, flow goes to Accounting or insurnance branches, using the following expression:

substring(items()?['Apply_to_each']?['DisplayName'],0,3)

 

Hope it helps!

Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!

View solution in original post

@fchopoThank you for the assistance, I am encountering an error though, it says "Template validation failed: the template acction 'Switch' at line '1' and column '2810' is not vaild: "the template languages function 'items' must have at least one parameter.

 

Also what is in the compose function? I just put in the 'Display Name' from the Get attachment step.

 

 

So i was able to get it to work. For the compose I used the 'DisplayName' from the 'Get Attachments' then for the switch I used

substring(outputs('Compose'),0,3)

And it is now working.

 

The last question I have, is there a way to make it more idiot proof? So that the capitalization of the file name would not matter?

I also was able to solve this issue by using the 'toUpper' command to change the file names to all uppercase then change the switch to all upper case.

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (71,385)