WP8 Looking for Mr SkyDrive

So far, my phone apps have been self contained and did not talk with the real world.  So my latest app involves communicating with a PC. There are a number of articles on using web services, but I wanted to be out of the loop. The user should be able to transfer from their PC to the phone and back. The obvious path seemed to be to use the user’s SkyDrive. Create a SkyDrive file on a PC and it will show up on your phone. Let your app create a SkyDrive file on your phone and it will show up on your PC.

So what is the big deal about transferring files? If you can do it, it opens a large possible number of potential apps. By transferring files to the phone, you can preload files or you can collect data on the phone and then upload the results for further processing.

So how do you do it?

One of the first things that comes up on StackOverflow is an answer that there is no API for the SkyDrive. Which was true at the time it was written. Now that has changed, but there is a mixture of incomplete information out there. StackOverflow is a good resource, but it is loaded with a lot of misinformation and partial information. You can find things, but it is a lot of work.

Microsoft does have information, but it is mish mash of C#, Java and C++ for Windows RT, Windows apps and Window Phone. The user is left to dissect the information and try to piece something together. The one phone example compiles with more errors than lines of code. I know the guys at Microsoft are smart, BUT… How about showing how smart you are by making simple examples rather than creating convoluted examples. (I got lost with the Win 8 apps examples because they had everything including the kitchen sink). Creating simple examples requires a lot of talent.

There is also the issue of signing in to SkyDrive. It would be nice just to treat SkyDrive as another drive, but the phone is not mine, it belongs to the user. So it is just common courtesy for me to ask the owners permission before playing with their SkyDrive. So far the examples I have seen need some User Experience improvements. They provide a Sign In button, but allow the user to press another button that will then do nothing but complain that the Sign In button was not pressed. The proper experience should be not to provide a Sign In button, but allow the user to choose the function they want and then pop up a sign in dialog if it is required.

So, what have I learned?

  • Files placed on SkyDrive have a name, but from an phone app, you need to know the files file id. So you have to write your own file picker.
  • To work on the file you need to move it to isolated storage. This may mean cleaning up the SkyDrive file.
  • http://msdn.microsoft.com/en-us/library/live/hh826531.aspx is a good reference, but…
    • it is a mish mash of platforms and languages,
    • it contains mistakes for the phone…
      • Windows is not a valid branding
      • Windows.UI.Xaml and Windows.UI.Xaml.Controls are not valid references
      • There is no explanation of folder ids or file ids – they just appear
  • The Live SDK has evolved so you have to know what is different in each version.
  • Not all versions of the Live SDK support Windows Phone 8
  • ASync has been added to the mix
  • When creating files, they are placed at the root. Since others can use a user’s SkyDrive. More care is needed when placing the files. In Isolated Storage, the app has full control of files so does not have to be too concerned about file directories. On the SkyDrive, the developer has to be sure to play nice with others.

So, what would I like? A simple Windows Phone example of downloading a file from SkyDrive and uploading a file back. Of course, this will requiring some explanations of SkyDrive directories, file types and aSync. The example also needs to be complete. I have seen numerous posts on StackOverflow embellishing on an answer because something was missing. A variable needed to be defined or a using was missing. Visual Studio is good at resolving missing Usings, but not always.

Now to see if I can mould the bits and pieces I have found into a simple working app.

John Marshall… Visio MVP       Visio.MVPs.org

Published by johnvisiomvp

The original Visio MVP. I have worked with the Visio team since 1993

One thought on “WP8 Looking for Mr SkyDrive

  1. I laughed when I read the line about “more errors than lines of code.” LOL! As you say! The scenario you talk about, IS SIMPLE! Create a file on the phone, press a button, ….magic happens here (hint hint hint Microsoft, this is where YOU add your input)…. file appears on your desktop! Magic, but it shouldn’t be! Good article John, I hope MS is reading/listening!

Comments are closed.