Junior Oliveira
Junior Oliveira

Reputation: 37

How can i get folder id of folders inside another folders in onedrive?

StringBuilder requestUri = new StringBuilder();
requestUri.AppendFormat(
    "https://apis.live.net/v5.0/me/skydrive/files?access_token={0}",
    propriedades["access_token"]);

WebClient myWebClient = new WebClient();
string json = myWebClient.DownloadString(requestUri.ToString());
cloud = new JavaScriptSerializer().Deserialize<Cloud>(json);

in this Json appears only informations of folders in root, like name, id..

How can i get folder id of folders inside another folders in onedrive? Using JSON i just can see folders id of folders in root, i cannot see folders id of folders inside another folders. For example, i have a folder id in root with name "Library" and inside this folder i have two folders with names "Book1" and "Book2", how can i get the folders id of these folders?

Upvotes: 1

Views: 3252

Answers (2)

Mitchel Sellers
Mitchel Sellers

Reputation: 63126

To answer the direct question that you have, you will need to traverse the folders on your own. The API calls only retrieve for the current level of folder structure. They don't work like a Windows File system does

Additionally I agree with Fals that it might be easier to use APIs that make it nicer for you. NOTE: Use the folder endpoint if looking at folders for ease of use.

Here is the documentation as well.

Upvotes: 2

Fals
Fals

Reputation: 6839

You should use the OneDrive C# API or OneDrive JavaScript API, given that you need the JSON. The API is avaible at:

Working with Microsoft OneDrive folders and files

Upvotes: 0

Related Questions