locked
Problem in accessing SkyDrive using C# Windows Store App RRS feed

  • Question

  • Hi Everyone,

    I am developing an App for downloading the File (Doc,ppt or pdf) from skydrive. i found some reference

    code here http://msdn.microsoft.com/en-us/library/dn659730.aspx

    when i tried to use the code with my Visual Studio 2013 , i am getting error in the following line.

    async private void Button_Click(object sender, RoutedEventArgs e)
            {


                bool connected = false;
                try
                {
                    var authClient = new LiveAuthClient();
                    LiveLoginResult result = await authClient.LoginAsync(new string[] { "wl.signin", "wl.skydrive" });

                    if (result.Status == LiveConnectSessionStatus.Connected)
                    {
                        connected = true;
                        var connectClient = new LiveConnectClient(result.Session);
                        var meResult = await connectClient.GetAsync("me");
                        dynamic meData = meResult.Result;
                        
                    }
                }
                catch (LiveAuthException ex)
                {
                    // Display an error message.
                }
                catch (LiveConnectException ex)
                {
                    // Display an error message.
                }

    Error Message:

    An exception of type 'System.NullReferenceException' occurred in mscorlib.dll but was not handled in user code

    Additional information: Object reference not set to an instance of an object.


    Please help me in that , i want to download files from skydrive (shared files  , so that we do not need to login)

    Thanks,

    Ashok r

    Saturday, June 28, 2014 8:56 AM

Answers

  • Hi,

    If you want your app can download or upload file from OneDrive, the user must be signed in to his or her Microsoft account for your app to work with the user's info on OneDrive. You help the user do this by adding sign-in functionality to your app in the form of a button or a hyperlink. Please refer to the link below:

    http://msdn.microsoft.com/en-us/library/dn631823.aspx

    And I recommend you can see a sample:

    http://code.msdn.microsoft.com/windowsapps/Live-SDK-Windows-Developer-8ad35141

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    • Marked as answer by Anne Jing Tuesday, July 8, 2014 7:29 AM
    Monday, June 30, 2014 2:18 AM