Click here to Skip to main content
14,733,966 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to fetch all the folders in Onedrive(not files) using graph api. I am looking for query similar to the below query:

var folders=await client.Me.Drive.Root.Children.Request().GetAsync();

The above query fetches both files and folders and I am looking for folders only.
Thanks in advance.

What I have tried:

tried fetching all files using graph api
Updated 28-Apr-20 3:53am

1 solution

Solved by below code:

var folders = await client.Me.Drive.Root.Children.Request().GetAsync();

            foreach (var item in folders)
                    oneDriveFolders.Add(item.Id, item.Name);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900