Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8990997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:37:31+00:00 2026-06-15T22:37:31+00:00

I am using Live api to download SkyDrive files. My code has a download

  • 0

I am using Live api to download SkyDrive files.

My code has a download click event which triggers the OnDownloadedCompleted function.

OnDownloadedCompleted function copies the file to “filename”.

and calls the DefaultLaunch(), which takes in the “filename” and tries to launch it by the default program in windows phone 8.

When i execute this code (The file downloaded is a OneNote file) OneNote opens and says that the file can’t be open.

Can anyone please help me validate this code?

Thanks a lot!

private void btnDownload_Click(object sender, RoutedEventArgs e)
    {

        if (App.Current.LiveSession == null)
        {
            infoTextBlock.Text = "You must sign in first.";
        }
        else
        {
            LiveConnectClient client = new LiveConnectClient(App.Current.LiveSession);
            client.DownloadCompleted += new EventHandler<LiveDownloadCompletedEventArgs>(OnDownloadCompleted);

            client.DownloadAsync("file_id");

        }
    }

The code for OnDownloadCompleted is

void OnDownloadCompleted(object sender, LiveDownloadCompletedEventArgs e)
    {
        if (e.Result != null)
        {
            var filestream = File.Create(@"filename");
            e.Result.Seek(0, SeekOrigin.Begin);
            e.Result.CopyTo(filestream);
            filestream.Close();
            DefaultLaunch();

            e.Result.Close();

        }
        else
        {
            infoTextBlock.Text = "Error downloading image: " + e.Error.ToString();
        }
    }

The code for Default launch function is

 async void DefaultLaunch()
    {

        try
        {
            string imageFile = @"File.one";
            var file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(imageFile);
            var success = await Windows.System.Launcher.LaunchFileAsync(file);
            if (success)
            {}
            else
            {}
        }
        catch (Exception e)
        {
            Console.WriteLine(e.StackTrace);
            Console.WriteLine(e.ToString());

        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T22:37:32+00:00Added an answer on June 15, 2026 at 10:37 pm

    try this tutorial.. http://msdn.microsoft.com/en-us/live/ff519582.aspx.. it is given there how to use live sdk in windows 8 platform

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using this code to post some data $('.update_btn').live(click,function() { var ID =
I'm testing SkyDrive's API using the following code: Dim webRequest As HttpWebRequest = DirectCast(HttpWebRequest.Create(https://apis.live.net/v5.0/me/skydrive/files?access_token=
I'm considering using live() to bind an event handler to a function I haven't
I have to download 2.5k+ files using curl. I'm using Drupals inbuilt batch api
I am using AVPlayer to stream some live HTTP audio, not AVAudioPlayer which does
When trying to run the sample code here: http://www.nikhilk.net/Live-Search-REST-API.aspx I get: Error 52 The
I'm trying fetch a live currency rate using the following API. http://www.exchangerate-api.com/INR/USD/1?k=FQRxs-xT2tk-NExQj When I
Since $(table).delegate(td, hover, function(){ $(this).toggleClass(hover); }); Is equivalent to the following code written using
So I'm trying to set up a YQL table using the API at http://www.teamliquid.net/video/streams/?filter=live&xml=1
I'm working on an implementation of a live-updating line graph using gRaphael which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.