Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

Flow for Looking Up OneDrive File Names then Comparing to D365 Contact Names then Send Email

I'm relatively new to Flow.  Logically, it seems that you may:


  1. Take a set of documents from a OneDrive (or SharePoint) folder (i.e. \Reports)
    1. For the sake of simplicity here, file naming convention would be 'LastFirstMI.pdf' (i.e. SmithJasonN.pdf)
    2. We need to match up with D365 contact record.  So if D365 contact name is 'Smith, Jason N' we'll need to use the file name. I understand it may be complicated to accurately parse/format the name as (Last, First MI) from the file name.
  2. We then need to go out to D365 and look for the matching contact record
  3. Send an email to the Primary email address of the D365 contact record
    1. Attach the respective file from OneDrive (so in the Smith example, SmithJasonN.pdf would attach to the email to Smith, Jason N in D365 contact entity

Is this viable using Flow?


Dual Super User II
Dual Super User II

Hi @RugerSR762 


It is rather difficult to extract the first name, last name and the middle index from a filename from OneDrive or SharePoint. However, if you wish to do it the other way round, here is an example for you: 




Here, I am getting the contacts list and appending the LastName, FirstName and MiddleName along with .pdf and listing the files with that name from SharePoint. Then I get the content of that file from sharepoint and send it as an email to the primary email address of the contact. 


Expression used is:


Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Helpful resources

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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!


Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (55,449)