Saving Live SDK profile pic as jpg


  • So I am trying to save my Live SDK profile image to local storage. The temp image is usable when I bind it as imagesource to image control inside app. I tried using the uri of this image source to download the file to my local storage. The url works perfectly when used in google chrome and image gets downloaded instantly but during runtime inside app on using breakpoints found it gets stuck on
    DownloadOperation download2 = downloader2.CreateDownload(source, destinationFile);
    and doesn't proceed to
    await download2.StartAsync();
    . Why cant i download image in store app using the same link that works fine in browser?

     var photoResult = await connect.GetAsync("me/picture");
                                dynamic photoResultdyn = photoResult.Result;
                                var image = new BitmapImage(new Uri(photoResultdyn.location, UriKind.Absolute));
                                App.img = image;
                                Windows.Storage.StorageFolder localFolder1 = Windows.Storage.ApplicationData.Current.LocalFolder;
                                StorageFolder newFolder41 =
                                    await localFolder1.CreateFolderAsync("Bundle",
                                string bundlesubjPath1 = "Bundle\\" + App.Username + "\\profilephoto.jpg";
                                string url = image.UriSource.AbsoluteUri;
                                Uri source = new Uri(url);
                                StorageFile destinationFile;
                                    destinationFile = await ApplicationData.Current.LocalFolder.CreateFileAsync(bundlesubjPath1, CreationCollisionOption.OpenIfExists);
                                catch (FileNotFoundException ex)
                                BackgroundDownloader downloader2 = new BackgroundDownloader();
                                DownloadOperation download2 = downloader2.CreateDownload(source, destinationFile);
                                await download2.StartAsync();
                                ResponseInformation response1 = download2.GetResponseInformation();

    Monday, December 8, 2014 8:06 AM