cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate I
Advocate I

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
Highlighted

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
Highlighted
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!
If you liked my response, please consider giving it a thumbs up. THANKS!


Proud to be a Flownaut!





Community Leader: Black Country PowerApps & Flow User Group

Advocate I
Advocate I

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.
Highlighted

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

Highlighted
Advocate I
Advocate I

Re: Creating a Folder in OneDrive from Graph in Flow

This works! Thank you!!

Helpful resources

Announcements
firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

Top Solution Authors
Users online (6,309)