简体   繁体   中英

How to read the list of files in a specific SkyDrive folder?

I know I can get the list of file in SkyDrive root by using liveClient.GetAsync("me/skydrive/files") and if I know the folder ID I can use liveClient.GetAsync(folderId + "/files") , so I don't want these as answers :)

Is there an easy way to get the list of files in a specific folder other that going through all user's folders and 3-levels deep to get the files inside "folderX/folderY/folderZ"?

I think this code will help you.

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;
            }
        }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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