What a tricky bit of code.. for anyone interested, here's how you do it:
// This button reads the file from skydrive and puts it into isolated storage
private async void Button_Click(object sender, RoutedEventArgs e)
{
string id = string.Empty;
LiveOperationResult result = await this.client.GetAsync("me/skydrive/files");
List<object> items = result.Result["data"] as List<object>;
foreach (object item in items)
{
IDictionary<string, object> file = item as IDictionary<string, object>;
if (file["name"].ToString() == "somefile.txt")
{
id = file["id"].ToString();
}
}
MessageBox.Show(id.ToString());
LiveDownloadOperationResult result2 = await client.DownloadAsync(string.Format("{0}/content", id));
Stream stream = result2.Stream;
using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication())
{
using (IsolatedStorageFileStream fileToSave = storage.OpenFile("foo.txt", FileMode.Create, FileAccess.ReadWrite))
{
stream.CopyTo(fileToSave);
stream.Flush();
stream.Close();
}
}
}