我正在开发一个 Windows 运行时通用应用程序。
我需要将我在应用程序中使用的数据库上传到用户的 OneDrive?
但FileNotFound
出现异常。但我知道路径是正确的。
由于我引用了 sqlite 文件,因此它显示了异常。如果我参考 txt 文件,上传过程会顺利进行。
var authClient = new LiveAuthClient();
var authResult = await authClient.LoginAsync(new string[] { "wl.skydrive", "wl.skydrive_update" });
if (authResult.Session != null)
{
var liveConnectClient = new LiveConnectClient(authResult.Session);
var FileToUpload = await ApplicationData.Current.LocalFolder.GetFileAsync("text.sqlite");//exception occurs here
var FileToUpload = await ApplicationData.Current.LocalFolder.GetFileAsync("text.txt");//no exception for txt files
var folderData = new Dictionary<string, object>();
folderData.Add("name", "Folder")
LiveOperationResult operationResult = await liveConnectClient.PostAsync("me/skydrive", folderData);
LiveUploadOperation uploadOperation = await liveConnectClient.CreateBackgroundUploadAsync(folderId, "filename", FileToUpload, OverwriteOption.Overwrite);
LiveOperationResult uploadResult = await uploadOperation.StartAsync();
HandleUploadResult(uploadResult);
}