SkyDrive SDK - first impressions. Not good ones. RRS feed

  • Question

  • Here is my first time experience with the Windows Phone SkyDrive API. I am not a novice developer, being a Silverlight MVP, and more than 13 years of Microsoft development behind me, but I am new to the Live SDK.

    My goal is to create a directory on SkyDrive, list the files in there, upload a new one and download one which the user has selected. Nothing complicated.

    I made the mistake of not downloading any samples. I tried to get by from the API itself, the online documentation and fellow blogger’s posts. Here is how it went.

    1. I wasted almost two hours with the login button not working – the reason was that “mobile” was not set for the application ID I created. There was no error message on the phone, nothing – the login button control showed me some progress dots, and then returned without the login dialog ever showing up.
      How this can be fixed: Creating the application ID should not just create one, but take me to the edit details screens. That way I would have KNOWN there was more behind the application IDs than just a name. And show a proper error message.
    2. I wasted over an hour with uploading my first file. I naively thought that I would create the target folder from the SkyDrive web interface, and just tell the LiveConnectClient to upload to that folder. The UploadAsync method has a path parameter of string, so I expected it to be a simple Windows-like path. No such luck. The problem was even worse: the UploadAsync method’s completed event was never called, instead I got a parameter null exception from inside the Live SDK. Since it came on a separate background thread, it counts as a top level exception, and there is no good way to catch it and show the error to the user.
      How this can be fixed: Since you have your own special way of handling folders, do not expect the developer to be able to put together a folder string. Create a strongly typed Path structure. That would immediately show the developer that there is more to handling paths than just “AAA/BBB/CC/XX.txt”. Or just throw an exception if you see a / or \ in the path. Or even better, do your best to understand these kind of paths, perform the async calls in the background and only notify me of the result or error!
    3. Currently I am trying to enumerate the files in a folder. I just gave up after 2 hours, it is 10 PM here. I managed to get the subfolder’s ID, but have no idea how to request the files inside. How to compose that path string. I looked at the documentation, there is no sample code on going 1, 2, or 3 directories down. How this can be fixed: see previous. Show me how to generate the path.
    4. The SignIn button is not designer friendly, it shows an error in Blend. Fortunately the rest of the page still loads.

    I’ve spent half a day on an otherwise trivial task, and I feel I am farther from the finish line than when I started. I had to use the debugger every step of the way to see what the API returns. I had to add tons of castings, since the API prefers List<Object>, and after you get that, you realize that object is really a Dictionary<string, object>. Where the last object is in fact… meh, you get the point. I write a line of code, restart the app and check with the breakpoint what the result is. That is if I get back any, and not just some unhandled exception from the background thread the API is working on.

    Please, make the developer experience better! Make it so that the API forces me to do the right thing by hiding the magic strings behind strongly typed objects, such as Folder, Path, File. Or change the API so that it can handle the way people usually think about folders and files: a simple string path separated by ‘/’ or ‘\’ characters. And handle all the multiple calls for me. Just getting a few levels deep in the directory structure takes hundreds of lines of code, especially with progress feedback and error handling every step of the way and no async / await on WP7. Or if I missed some trivial information that could have spared me all this trouble, put that in big bold blinking letters to the front of the SDK documentation.

    Thank you,

    András Velvárt

    Silverlight MVP.

    Sunday, July 15, 2012 8:47 PM


  • Thanks for reporting these challenges you encountered while trying to use the SkyDrive APIs. A number of these issues could have been avoided if you had read our documentation or visited the interactive SDK prior to starting development. That said there is good feedback on ensuring that our error messages guide developers in the right direction. 

    On the topic of the SignIn button not working in Blend, it should work fine in Blend for Windows Phone. It isn't supported in any other version of Blend. 

    Thanks for the feedback and you will definitely see some improvements in this area in the future. 

    Wednesday, July 18, 2012 8:59 PM