cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LuiseFreese
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

@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

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

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.

@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

This works! Thank you!!

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,234)