skydrive, Windows Phone 7

wp7 skydrive upload

Technorati Tags:

Download the sdk, which at the time of writing is here http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=28195

Next, head over to https://manage.dev.live.com/Applications/Index and add an application. This will provide you with an application Id and a client secret token. You also need to configure a valid redirect url as required by the OAuth handshake.

 

liveappreg

 

Add a reference to Microsoft.Live and Microsoft.Live.Controls. (included with the SDK)

Add a SignInButton to your page.

 

<Controls:SignInButton x:Name="signInButton" Height="120"
                                   ClientId="XXXXXXXXXXXXXXXX"
                                   SessionChanged="SignInButtonSessionChanged"
                                   Scopes="wl.skydrive_update"
                                   RenderTransformOrigin="0.5,0.5" 
                                   d:IsHidden="True">

 

Now, you should be able to click on the sign in button, get redirected to the live login page.  After logging in you will be required to give consent for the requested authorisation. This will look like this:

 

authorise 

We then wire up a handler to the SignInButton SessionChanged event and if the sign in was successful we will get a LiveConnectSession object passed in the event.

            if (e.Status == LiveConnectSessionStatus.Connected)
            {
                VisualStateManager.GoToState(this, "SignedIn", true);
                _liveConnectSession = e.Session;
            }

 

A LiveConnectClient object can be constructed from the session object and used to carry out standard operations, i.e. upload, delete, copy, etc.

 

Find the project here:

https://skydrive.live.com/redir.aspx?cid=4f1b7368284539e5&resid=4F1B7368284539E5!435&parid=4F1B7368284539E5!123

Tagged

2 thoughts on “wp7 skydrive upload

Leave a Reply

Your email address will not be published. Required fields are marked *