Cal*_*nus 8 c# windows-phone-7 onedrive
有谁知道如何获取特定SkyDrive文件夹的文件列表?目前我正在使用以下代码片段来尝试获取根SkyDrive文件夹的文件:
var client = new LiveConnectClient(e.Session);
client.GetCompleted += (obj, arg) =>
{
...
}
client.GetAsync("me/skydrive");
Run Code Online (Sandbox Code Playgroud)
但它返回的是一个Result字典,其中包含大量信息但没有文件名列表!
Pat*_*ick 10
根据OneDrive核心概念(以前的SkyDrive),您可以在顶层目录或特定文件夹中列出两个文件列表.如您所知,您可以使用列出顶级文件
liveClient.GetAsync("me/skydrive/files");
Run Code Online (Sandbox Code Playgroud)
folderId + "/files"例如,对于您使用的特定文件夹
liveClient.GetAsync(folder.Id + "/files");
Run Code Online (Sandbox Code Playgroud)
在GetCompleted事件中,你可以列出从数据钥匙的所有文件
private void onFilesInformationDownloaded(object sender,
LiveOperationCompletedEventArgs e) {
if (e.Result == null) {
// check e.Error for reason why it failed
return;
}
List<object> data = (List<object>)e.Result["data"];
foreach (IDictionary<string, object> content in data) {
string type = (string)content["type"];
if (type == "folder") {
// do something with folders?
}
string filename = (string)content["name"];
string fileId = (string)content["id"];
// use fileId to download a file or list files in a folder
// there's a few more details available in content.Keys
// such as created_time and updated_time for those interested
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6775 次 |
| 最近记录: |