web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Select only one file f...
Power Automate
Suggested Answer

Select only one file from OneDrive Business

(0) ShareShare
ReportReport
Posted on by 72
Hi Everyone,
 
I'm creating customized emails to my customers that includes monthly reports for the products they are using.
 
My monthly reports are in a OneDrive Business folder and named as:
  • Monthly Report-Windows.xlsx
  • Monthly Report-Mac.xlsx
  • Monthly Report-Linux.xlsx
 
One customer receives only one report - e.g. 
  • Customer A > Monthly Report-Windows.xlsx
  • Customer B > Monthly Report-Linux.xlsx
  • Customer C > Monthly Report-Mac.xlsx
 
I'm using Graph API to create draft emails and I'm then sending them. 
 
My challenge is including the report in the Graph API call. I select the files using "Find files in folder" to get the unique FileID, but the next step is always for-each loop, even if I select one file to return:
 

How can I select one specific file so that I can include it in the API Call? 
 
Thank you!
 
Cheers,
Tolga
Categories:
I have the same question (0)
  • Suggested answer
    Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at
    I don't think there is any issue. Find files action is returning a collection which is why it is applying a loop. If you are selecting only one file then it will work only for that file not for other files.
     
  • David_MA Profile Picture
    13,446 Super User 2026 Season 1 on at
    I think you need to take a different approach, which I cannot tell you how without better understanding your goal.  Your flow does not look correct based on what you describe. If you use the Get files action and limit it to 1 file, how can you be sure the correct file out of the three is the one that should be sent? If you don't care which one of the files is sent, then what @Hardesh15 said would be true.
  • Pstork1 Profile Picture
    68,898 Most Valuable Professional on at
    If you always want the first file to be returned you can always use the first() function to avoid the loop and select the first file.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • tolga-balci Profile Picture
    72 on at
    Hi All,
     
    Thanks very much for the answers. Here is a bit of clarification (@David_MA)
     
    I have the following files under a OneDrive folder:
     
     
    I want to select one file from this directory - e.g. "Monthly Report-Windows.xlsx"
     
    Once I select this one file, I will get its name and content bytes stored in variables to use in a Graph API call:
     
    {
    "@odata.type": "#microsoft.graph.fileAttachment",
    "name": "Monthly Report-Windows.xlsx",
    "contentBytes": "R0lGODdhEAYEAA7"
    }
     
    In another step, I will do the same, but for another file - e.g. "Monthly Report-Linux.xlsx", and then get its name and content bytes, use those in another Graph API call. The reason for this is to satisfy the business requirement as I mentioned before - one customer receives only one report, therefore there will be different Graph API calls for each customer:
    • Customer A > Monthly Report-Windows.xlsx
    • Customer B > Monthly Report-Linux.xlsx
    • Customer C > Monthly Report-Mac.xlsx
     
    Hope it's clear now.
     
    Thanks much!
     
    Cheers

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 307 Super User 2026 Season 1

#2
David_MA Profile Picture

David_MA 269 Super User 2026 Season 1

#3
Power Platform 1919 Profile Picture

Power Platform 1919 115 Super User 2026 Season 1

Last 30 days Overall leaderboard