UWP uses the OneDrive cloud storage 2.x API (i) "All-network debut"

Source: Internet
Author: User
Tags oauth

The recent development of face recognition UWP "micro-recognition/werecognition" has been developed for OneDrive, so let's take a look at the ins and outs.

Https://www.microsoft.com/store/productId/9PDSNS7X9ST9, the store hot selling ...

Because the UWP is cross-platform, a set of code can run on all Windows 10 devices, such as phones, computers, holograms, hubs, Xbox, and so on.

So the question is, since the app can run across the screen, it's a good idea for UWP developers to implement app settings and data across platforms in order to create a completely seamless, best -fit experience for users.

For the average developer, buying a cloud database costs a lot of money, and there is a difference in access speed; it costs more to buy one or build a server of your own.

Why doesn't it have to be ready?

To achieve data cross-platform use, there are two methods:

1. Using Data roaming Roaming

2. Use OneDrive for storage

Advantages and disadvantages of data roaming roaming

Pros: Easy and easy to use, roaming settings and files

Applicationdatacontainer roaming = windows.storage.applicationdata.current.roamingsettings;roaming. values["key"" roaming settings ";
// Roaming folders var roamingfolder = Windows.Storage.ApplicationData.Current.RoamingFolder; // create a file within the roaming folder, var await roamingfolder.createfileasync (filename, creationcollisionoption.openifexists); // Write Content " content that needs to be synced ");

If your data is small, such as some basic settings, as well as the user name password and other small files, with this most convenient.

But there are size restrictions "some say 8KB, also say 100KB" reference http://www.cnblogs.com/ms-uap/p/4184328.html the Great God speaks clearly

OneDrive Storage Pros and cons

Advantages: Can store large files, now as long as the registration to send 5G, or 15G again, forget. Anyway, I have 30G size. The education version has 1T ...

5G enough for you, if your data file is larger than 1G, it is best not to do roaming, copy the past directly. The broadband uploads in the celestial kingdom are small pipes.

Cons: no information! No information!! no information!!!

Also, don't go to official documents, don't go to official documents, don't look at official documents.

Https://docs.microsoft.com/zh-cn/onedrive/developer/rest-api/getting-started/graph-oauth

You said I was in lie, online a search clearly have some, Gayhub also has open source. Note that these are all developed based on the 1.x API, which Microsoft has not recommended in this way.

So the latest 2.x version of the API, you can not find any official sample or folk wild sample!!!

At least your official 2.x has been out for a year or two, there is no official sample, have to say that Microsoft's "efficiency is very". Gayhub before, but was removed by the official, there is only one historical note. I don't know about them. Why remove, probably do not want to let everyone use it.

Using the OneDrive API 2.x process is as follows

    1. Register the app to get the app ID.
    2. Use a token stream or code to flow through the specified scope to let the user log in. is the Signinasync function above.
    3. Upload download operation
    4. Log off the user (optional).

First register the app, not the store registration, but the OneDrive license registration https://docs.microsoft.com/zh-cn/onedrive/developer/rest-api/getting-started/ App-registration

So when I researched the 1.x API of the day, I found that Https://docs.microsoft.com/zh-cn/onedrive/developer/rest-api/getting-started/msa-oauth, My heart is refused, even feel a day??。

But you can use 1.x if you are not dead. And no one's got the machine gun on your head.

But Microsoft says you need Microsoft Graph for authentication and a series of operations.

Https://docs.microsoft.com/zh-cn/onedrive/developer/rest-api/getting-started/graph-oauth

But after looking at the official documents and some code, the app still fails to authorize various attempts. Day the dog felt.

This comes back to the end, about how to use the new version, and listen to tell.

UWP uses the OneDrive cloud storage 2.x API (i) "All-network debut"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.