cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LuiseFreese
Level: Powered On

Creating a Folder in OneDrive from Graph in Flow

Hi, I try to build a flow which creates a new folder in my OneDrive. To get an easy start, I just used the mobile button.

 

flow 1.png

 

As there is no "create a folder oin OneDrive" action, I thought about a HTTP action. I registered an app in Azure AD, gave permissions and initialialized variables TenantID, App ID, App Secret because need them in my http action.

flow 2.png

I also initalized a variable for "me":

 

in Microsoft Graph i used this to get my ID:

 

flow 3.png

 

and got this response:

flow 4.png

I wrote this ID into a variable called "me".

 

My flow looks like this:

 

flow 5.png

 

Flow runs perfectly without error messages - BUT!

 

It doesn't create a new folder in my onedrive but in SharePoint:

 

flow 6.png

 

translation: Freigegebene Dokumente = Shared Documents

 

this is the URL:

 

https://raeuberleiterin.sharepoint.com/Freigegebene%20Dokumente/Forms/AllItems.aspx?RootFolder=%2FFr...

 

When I try to create a folder in my onedrive directly with MS Graph using POST method the folder is created in my OneDrive.

 

flow 7.png

 

I don't understand the problem  - anybody who has some kind of idea?

 

 

Thanks,

 

Luise

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
TomaszPoszytek
Level: Powered On

Re: Creating a Folder in OneDrive from Graph in Flow

@LuiseFreese if you already have your user's ID and facing issues with calling /me/ directly form Flow, maybe try using /users/ instead? So then your request should call the following URL:


https://graph.microsoft.com/v1.0/users/YOUR-ID/drive/root/children

 

And body as you wrote, e.g.:

 

{
"name": "Test2",
"folder":{}
}

 

Best regards,

Tomasz

View solution in original post

4 REPLIES 4
Super User
Super User

Re: Creating a Folder in OneDrive from Graph in Flow

Hi @LuiseFreese are you going to do something with Folder once it's been created i.e. putting something in there as part of this Flow or is it simply to create a Folder?

 

If you're going to put a document in there, the action of Create File in OneDrive for Business will ask you to provide a Folder. If the Folder doesn't exist, it will create it, and will then create the document in there.

 

If you're only going to create a folder, I suppose a less elegant way of doing it, but without the hassle of App IDs etc, would be to create a File to force the creation of the folder, and then delete the file straight away leaving the folder empty.

 

I'll have a look at the Graph call in the morning to see if I can recreate the issue and to see what might be causing it.

 





Did my reply help? Please give it a thumbs up.
Did I answer your question? Please mark my post as a solution!


Proud to be a Flownaut!





Community Leader: Black Country PowerApps & Flow User Group

Highlighted
LuiseFreese
Level: Powered On

Re: Creating a Folder in OneDrive from Graph in Flow

Hi,

Thanks for reaching out. First, I just want to understand why this doesn't work. I found a way to do it, just used the azure connector.
TomaszPoszytek
Level: Powered On

Re: Creating a Folder in OneDrive from Graph in Flow

@LuiseFreese if you already have your user's ID and facing issues with calling /me/ directly form Flow, maybe try using /users/ instead? So then your request should call the following URL:


https://graph.microsoft.com/v1.0/users/YOUR-ID/drive/root/children

 

And body as you wrote, e.g.:

 

{
"name": "Test2",
"folder":{}
}

 

Best regards,

Tomasz

View solution in original post

LuiseFreese
Level: Powered On

Re: Creating a Folder in OneDrive from Graph in Flow

This works! Thank you!!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 320 members 6,127 guests
Please welcome our newest community members: