SkyDriveBrief Introduction
Windows Live SkyDrive is a network disk launched by Microsoft to store files online. You need to log on to your account with a Microsoft account. Now the Win8 system comes with this application. When we have installed the Win8 system, we can see that there is this application on the metro desktop. If our Win8 system is logged on with a Microsoft account, therefore, you will not be asked to log on to this application. This is what I will introduce later. In Win8, the live account is single-point logon.
Integrate SkyDrive in applicationsBenefits
In fact, this benefit can also be said to be the advantage of the network disk, we all know that the advantages of the network disk is very convenient, do not need to rely on external storage devices or a PC, as long as there is a network, we can easily browse our files. In our applications, we can rely on Microsoft's SkyDrive SDK to interact with SkyDrive. When we browse a file, we can upload or share the file to SkyDrive (which has been implemented currently). We can open the PDF file in SkyDrive and modify it. After modification, we can update the file to SkyDrive, of course, these operations must be associated with the account.
How to integrate SkyDrive in applications
Microsoft has opened the live SDK, which provides access interfaces for all types of files in SkyDrive. However, this SDK does not support C ++, therefore, C # is used to encapsulate windows runtime components for C ++ calls.
Single login
ApplicationProgramOne of the key advantages of integration with the live SDK is that you can use a Microsoft account for Single login. A Single login means that if a Win8 user only needs to use a Microsoft account to log on to the PC, microsoft applications (such as mail, messaging, and SkyDrive) do not need to log on again. This improves the user's health check, and users do not need to perform different applications, you will be prompted to log on.
Open interfaces
The live SDK includes the following APIs: Live API, message API, identity API, and Hotmail API.
Of course, we mainly use live APIs (mainly used for user login judgment and user information retrieval) and SkyDrive APIs.
1. obtain basic account information through the live connect API
2. Obtain all folders and files under the corresponding account by using the SkyDrive API.
(1) upload and download files
(2) update files
(3) Delete an object
(4) create a file
3. You can obtain album, video, and audio files.
See http://msdn.microsoft.com/en-us/library/live/hh826521.aspx for details
How to call Interfaces
1. Open the webpage at http://msdn.microsoft.com/zh-cn/live/ff621310to download the live SDK package.
2. Install the SDK package
3. First, create a Windows Store application, then add the reference, "extension"-"Live SDK"
4. Next, refer to callback.
5. We will first perform the simplest interface to test whether to connect.
/// <Summary> /// log on /// </Summary> async private void liveconnect () {try {If (! Windows. applicationModel. designMode. designmodeenabled) {liveauthclient authclient = new liveauthclient (); liveloginresult authresult = await authclient. loginasync (new list <string> () {"WL. signin "," WL. basic "," WL. skyDrive "," WL. contacts_skydrive "," WL. skydrive_update "}); If (authresult. status = liveconnectsessionstatus. connected) {// an app level property for the session. session = authresult. s Ession; isconnect = true; liveclient = new liveconnectclient (session); tbmessage. Text = "Connect success! ";}Else {messagedialog dialog = new messagedialog (" Connect failed! "); Await dialog. showasync () ;}} catch (liveconnectexception exception) {tbmessage. Text = Exception. Message. tostring ();}}
6. When the program runs, er, there is an error. Let's take a closer look at the document. We had to configure our app before calling the live SDK interface. It is relatively simple to refer to sotre, you only need to follow these steps, but you need a developer account ~
If you just want to perform a simple test, you can log on to the App Store and create an empty app. You only need to set a name for the app, and then follow the steps above to perform the test, right-click your local project name
You will be prompted to enter an account. after entering the account, all your applications will be displayed. Click the empty application you just created ~
7. OK. Now that the settings are complete, the local application can successfully pass
8. Check the running result: