【发布时间】:2016-01-11 01:07:19
【问题描述】:
是否有任何代码 sn-p 可以帮助我完成这项任务?
- 对 OneDrive 的身份验证
- 在文本文件中保存一些变量,将该文件上传到 OneDrive。
- 从 OneDrive 获取变量(如果存在)。
我使用通用 Windows 10 应用程序并希望用户将他们的设置保存在 OneDrive 上,以便以后从任何其他设备获取它们。
感谢所有帮助
【问题讨论】:
标签: c# authentication uwp onedrive
是否有任何代码 sn-p 可以帮助我完成这项任务?
我使用通用 Windows 10 应用程序并希望用户将他们的设置保存在 OneDrive 上,以便以后从任何其他设备获取它们。
感谢所有帮助
【问题讨论】:
标签: c# authentication uwp onedrive
// Create a simple text file at onedrive:\Apps\<your UWP name>\Some Folder\Some File.txt
// GetUniversalClient won't work until you associate your app with the store
var onedrive = OneDriveClientExtensions.GetUniversalClient(new[] { "wl.signin", "onedrive.appfolder" });
await onedrive.AuthenticateAsync();
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes("Hello onedrive")))
{
await onedrive.Drive.Special.AppRoot
.ItemWithPath("Some Folder/Some File.txt").Content
.Request().PutAsync<Item>(stream);
}
【讨论】:
Here你可以找到示例和api文档。
【讨论】: