locked
Accessing the contents of a Skydrive text file using JavaScript RRS feed

Answers

  • Hi Geoff,

    I was able to do this using WinJS.xhr.  I do not know enough about the SkyDrive API to help you there.

    I simply used the .source property of the SkyDrive element:

      WinJS.xhr({ url: file.source }).
                then(onTextFile);
    
      function onTextFile(result) {
    
            var a = result.resposeText;
    
        }
    

     The result object is the response object.

    -Jeff


    Jeff Sanders (MSFT)
    Friday, January 20, 2012 4:00 PM
    Moderator

All replies

  • Hi Geoff,

    http://msdn.microsoft.com/en-us/windowslive/hh561740#downloading_files

    Has a section on how to do this in Metro style apps with the file picker.  Did you try that code?

    -Jeff


    Jeff Sanders (MSFT)
    Tuesday, January 17, 2012 5:01 PM
    Moderator
  • Hi Jeff

    Thanks for your quick reply.  The code you reference is downloading a Skydrive file to a local file, based on a file location selected by the user.  This is not what I want to do - I want to be able to get the contents of the Skydrive file (as a string), without having to save the file locally (which is a waste of time).

    I guess I could try to adapt the example code (downloading to a local file without user intervention), however I would need to work out how I create an appropriate "file" object.

    Many thanks

    Geoff Olding

    Tuesday, January 17, 2012 5:57 PM
  • I got you.  That really is not a Metro style app question.  You should ask the Live SDK forums: http://social.msdn.microsoft.com/Forums/en-US/messengerconnect/threads

    I am sure someone has wanted to so this in JavaScript before.  Also I have not watch this yet but you may get some hints from this Build Talk: http://channel9.msdn.com/Events/BUILD/BUILD2011/PLAT-134C

    -Jeff

     

     


    Jeff Sanders (MSFT)
    Tuesday, January 17, 2012 7:00 PM
    Moderator
  • Hi Geoff,

    I was able to do this using WinJS.xhr.  I do not know enough about the SkyDrive API to help you there.

    I simply used the .source property of the SkyDrive element:

      WinJS.xhr({ url: file.source }).
                then(onTextFile);
    
      function onTextFile(result) {
    
            var a = result.resposeText;
    
        }
    

     The result object is the response object.

    -Jeff


    Jeff Sanders (MSFT)
    Friday, January 20, 2012 4:00 PM
    Moderator
  • Hello there

     

    You are a star! 

     

    N.B. The SjyDrive API documentation in this respect is very unclear.

     

    Regards

     

    Geoff Olding

    Sunday, January 22, 2012 7:26 PM