简体   繁体   中英

c# - MS Skydrive - getting info on users' account.

I'm creating ac# winform application and I want to be able to display a users MS SkyDrive info, specifically the free space on their SkyDrive and the used space. I'm on Windows 7 and I'm trying to do this but I'm having a real hard time getting an access token after the user authenticates. So far, this is all I've been able to piece together:

public void getInfo()
    {

        var uri = "https://login.live.com/oauth20_authorize.srf";
        var authorizeUri = new StringBuilder(uri);

        authorizeUri.AppendFormat("?client_id={0}&", "<client id>");
        authorizeUri.AppendFormat("scope={0}&", "wl.signin");
        authorizeUri.AppendFormat("response_type={0}&", "token");
        authorizeUri.AppendFormat("redirect_uri={0}", HttpUtility.UrlEncode("<redirect domain>"));

        var startInfo = new ProcessStartInfo();
        startInfo.FileName = authorizeUri.ToString();
        Process.Start(startInfo);

    }

This pops up a browser and allows the user to give permission to the app. However, it returns the access token by redirecting to the apps 'redirct url' and including the access token in the url. This really doesn't help me as my application is a desktop app. I've been reading Microsoft's docs and can't find anything other than info for Windows 8 and windows phones.

How am I supposed to do this?

You can try: http://skydriveapiclient.codeplex.com/

I used it for the same reason you want to use it. For me it worked well. There is an example application using this http://skydrivesync.codeplex.com/

I'm sorry I can provide you the code, because I only used it for testing and it got deleted

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM