SkyDrive is a microsoft free cloud storage.
You can perform Read\Write\Delete over Directories\Files\Albums. Sharing is also possible
Download the Live SDK
SkyDrive is actually a part of Live Connect which consists also :
- Hotmail - mail
- Messanger - chat
- Windos Live ID - authentication
Live Connect use standard protocols such as HTTP, OAuth 2.0, JSON, XMPP and REST.
The Live Connect REST API exchange info between application in JSON format.
Basically you have to sign in to get authenticated via your Live ID. This can be done via SignInButton.
Important properties of SignInButton :
- ClientID - The ID of the registerd application. You get this from Windows Live My Apps
- Scopes - Specify the type of permission you grant to operate on your SkyDrive e.g. wl.skydrive_update grant read\write access to the user files
- RedirectUri - This is the page that the user is directed after clicking the SignInButton. https://oauth.live.com/desktop is used for mobile application
- Branding - This is type BrandingType. It specify the display icon
- TextType - Specify the SignInButton Text
- Session - Identify the session for the authenticated user
Important event of SignInButton :
- SessionChanged - Notifies when the Session property has changed
After the authentication phase via SignInButton you are able to create an object type LiveConnectClient.
LiveConnectClient expose an end poin tof the Live Connect web service.
Methods of LiveConnectClient are helper function for making calls to REST API
When your application makes a GET request for an object via the methods of LiveConnectClient, the Live Connect REST API returns the requested info as a JSON formatted structure.
When your application makes a POST or PUT request via the methods of LiveConnectClient, the Live Connect REST API requires the submitted info to be a JSON formatted structure
Source Sample
SkyDrive_NK.zip
Hit the link to produce
Now enter the application name.- SkyDrive_NK and click accept to produce :
Click on "Application Setting Page" and change "Mobile client app" to Yes
MainPage.xaml
The Application has three buttons :
- SignInButton - sign in the user
- Create File In Isolated Storage - create file to be uploaded
- Upload File - uploaded the file in the isolated storage to SkyDrive
Do NOT forget to change the ClientId accordoding to what you got from Windows Live as described before
MainPage.xaml.cs
The following handles the sign in.
The following handles uploading the file a.txt from isolated storage to SkyDrive.
Notice that UploadAsync is used and after it's completion client_UploadedCompleted will be called.
Run the application to produce :
Click on the Sign In button to produce :
Enter Windows Live ID e.g. your hotmail account and password to produce :
Click the Yes button to produce :
Click the button "Create File In Isolated Storage" to create a file in the isolated storage :
Click the button "Upload File" to copy the file from isolated storage to your SkyDrive
Now open your SkiDrive (https://skydrive.live.com/) and see that the file got there
Nathan
No comments:
Post a Comment