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 / Create File (Folder) W...
Power Automate
Unanswered

Create File (Folder) Within OneDrive For Business in a specific location

(0) ShareShare
ReportReport
Posted on by 2
I'm brand new to Power Automate and have been reading and watching videos (and searching the forum) on what I'm trying to accomplish. Sorry to ask a question that is probably very obvious. 
 
Basically, when a specific file is created in a OneDrive folder I want some other folders created and added to the folder where the original created file is located. Once I get this logic down, I have other items to add as well but I'm just struggling to create the folder (file) in the same location as the triggered file. I realize that OneDrive doesn't allow you to create folders and I can get around that by creating a file within a folder for it to make the folder and then can delete the file. 
 
I've learned that OneDrive encodes the file names so I was able to get the trigger to work by editing this condition:
 
 
 
My issue is that I'm not able to find that original folder with my create command. When I use the File Path expression for my folder path and then put a subfolder under that (below)
 
triggerOutputs()?['headers/x-ms-file-path-encoded'] and then I added my folder that I wanted it to create. 
 
 
 
 
 
When this fails,  input data is this below; which is including the name of the file in the path and therefore seems to not be letting me create a file using that. Is there a way to change the folder path to only read the folder names less the file name?
 
"folderPath""/drives/ENCODED FOLDER NAME/root:/Main Folder/Jobs/Job Name/Project Log - Job Name.xlsx\\Contract And COs",
 
 
Sorry if I've asked this in the most complicated way possible. If there is a simpler way to do this please let me know. We are basically kicking off a project by putting a specific file into the root of a OneDrive folder. Once that's found, I wanted Power Automate to create subfolders automatically. 
 
 
 
Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,335 Super User 2025 Season 2 on at
     
    I want to point out that SharePoint is behind OneDrive, so you can create the folder that way.
     
    I need to eat or I am gonna pass out but I will come back to you shortly. I just wanted to toss that out, because you can get the details, then use SharePoint actions to create it. then create your file
     
    So when the file is created and triggers the flow, use SharePoint actions to create your files, then grab the Content from the file and paste it whatever you want it (I mean create or copy or move)
  • JS-29051801-0 Profile Picture
    2 on at
    Thanks I'll try that. Sorry for the confusion and I appreciate the patience. I'm the de facto IT guy at our office and as we've grown our file storage has stayed somewhat the same (my personal OneDrive). And now I'm too deep to change without being down for a few days and also having to reconnect the entire office/field staff to a SharePoint site. But... I'm seeing that that is probably the best way to do this. 
     
    In regards to this below comment:
     
    So when the file is created and triggers the flow, use SharePoint actions to create your files, then grab the Content from the file and paste it whatever you want it (I mean create or copy or move)
     
    I can create the data that I need without issue (typically in the root of my OneDrive folder) or a selected SharePoint folder. My problem is trying to tell Power Automate where to move or copy the data to. I want it in the OneDrive folder that the trigger file is located in but I don't know how to tell it that location. The "FolderPath" command grabs the entire path including the file name. I'm guessing there might be a command/code to remove the portion of the file name in front of the last "/" highlighted below
     
    "folderPath""/drives/ENCODED FOLDER NAME/root:/Main Folder/Jobs/Job Name/Project Log - Job Name.xlsx,
     
     

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…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard