cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
darevandy
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
fchopo
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
fchopo
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
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Users online (37,891)