none
Get list of files from SkyDrive folder

    Question

  • Does anyone know how to get a list of files for a particular SkyDrive folder? Currently I'm using the following snippet to try and get the files for the root SkyDrive folder:

     

    var client = new LiveConnectClient(e.Session);

     

    client.GetCompleted += (obj, arg) =>

    {

     

     

    if (arg.Error == null)

     

     

    {

     

     

        var data = (List<object>)arg.Result["data"]; 
        
    List<string> files = new List<string>();

     

     

     

     

     

        foreach (IDictionary<string, object> file in data)

        {

            files.Add((

     

    string)file["name"]); 

     

        }

     

     

    }

     

    };

     

    client.GetAsync(

     

    "me/skydrive");

    However I always get a KeyNotFoundException for the "data" key. I don't understand why it isn't working for me - I'm using wl.signin and wl.skydrive_update scopes. I've also tried other skydrive folders but with no difference. Can someone please tell me what I am missing here?

    Thanks,
    Robin

     

     

     

     


    Monday, June 25, 2012 12:06 PM

Answers

  • http://isdk.dev.live.com/ is a great playground. Hint: It also features a really good documentation. In the Interactive SDK select SkyDrive -> REST and enter things like "me/skydrive" or "me/skydrive/files".

    You'll notive that "me/skydrive" doesn't have a ["data"] key and returns data about your root folder.
    On the other hand "me/skydrive/files" has a ["data"]key and returns data about the root folder's content, which is what you're after.


    Monday, June 25, 2012 12:26 PM

All replies

  • http://isdk.dev.live.com/ is a great playground. Hint: It also features a really good documentation. In the Interactive SDK select SkyDrive -> REST and enter things like "me/skydrive" or "me/skydrive/files".

    You'll notive that "me/skydrive" doesn't have a ["data"] key and returns data about your root folder.
    On the other hand "me/skydrive/files" has a ["data"]key and returns data about the root folder's content, which is what you're after.


    Monday, June 25, 2012 12:26 PM
  • Thanks - me/skydrive/files is the answer!
    Monday, June 25, 2012 12:58 PM