简体   繁体   English

如何获得OneDrive中另一个文件夹内的文件夹的文件夹ID?

[英]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.. 在此Json中,仅显示根目录中的文件夹信息,例如名称,ID。

How can i get folder id of folders inside another folders in onedrive? 如何获得OneDrive中另一个文件夹内的文件夹的文件夹ID? Using JSON i just can see folders id of folders in root, i cannot see folders id of folders inside another folders. 使用JSON,我只能看到根目录下的文件夹ID,而看不到另一个文件夹内的文件夹的ID。 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? 例如,我在根目录中有一个名为“ Library”的文件夹ID,在此文件夹中,我有两个名为“ Book1”和“ Book2”的文件夹,如何获得这些文件夹的文件夹ID?

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. API仅针对当前级别的文件夹结构调用检索。 They don't work like a Windows File system does 它们无法像Windows文件系统那样工作

Additionally I agree with Fals that it might be easier to use APIs that make it nicer for you. 此外,我同意Fals的看法,即使用更适合您的API可能会更容易。 NOTE: Use the folder endpoint if looking at folders for ease of use. 注意:如果要查看文件夹以便于使用,请使用文件夹端点。

Here is the documentation as well. 这里也是文档。

You should use the OneDrive C# API or OneDrive JavaScript API, given that you need the JSON. 如果需要JSON,则应使用OneDrive C#API或OneDrive JavaScript API。 The API is avaible at: 该API可在以下位置获得:

Working with Microsoft OneDrive folders and files 使用Microsoft OneDrive文件夹和文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM