0

我知道我可以通过使用获取 SkyDrive 根目录中的文件列表,liveClient.GetAsync("me/skydrive/files")如果我知道我可以使用的文件夹 ID liveClient.GetAsync(folderId + "/files"),所以我不希望这些作为答案:)

是否有一种简单的方法来获取特定文件夹中的文件列表,而不是遍历所有用户的文件夹和 3 级深度以获取“folderX/folderY/folderZ”中的文件?

4

1 回答 1

0

我认为这段代码会对你有所帮助。

private const string DropBoxUsername = "abc@hotmail.com";

private const string DropBoxPassword = "password";

private const string FolderName = "MainFolder";

private const string UserEmail = "abc@hotmail.com";

protected void BtnUploadClick(object sender, EventArgs e)

{

   var client = new SkyDriveServiceClient();
   // log on into drop box using username and password
   client.LogOn(DropBoxUsername, DropBoxPassword);

   // verifying the company folder is available or not
   WebFolderInfo userskyDrivefolder = null;

   WebFolderInfo clientskyDrivefolder = 
   client.ListRootWebFolders().FirstOrDefault(subWebFolder => subWebFolder.Name == FolderName);
    if (clientskyDrivefolder != null)
    {
        foreach (WebFolderInfo subWebFolder in client.ListSubWebFolders(clientskyDrivefolder))
        {
            if (subWebFolder.Name == UserEmail)
            {
                userskyDrivefolder = subWebFolder;
                break;
            }
        }
    }
}
于 2014-04-14T05:21:02.260 回答