在Microsoft Graph OneDrive 团队处理本教程Uploading File to OneDrive
时,我在下面显示的代码的最后一行收到以下错误:
备注:网上有一些帖子有相关问题,(如:这个,或这个,或这个或这个或这个)。但他们似乎都有不同的背景或没有回应。
问题:可能是什么问题,我们如何解决它
未找到段“根:”的资源
相关代码:
GraphServiceClient graphClient = ProviderManager.Instance.GlobalProvider.Graph;
var picker = new Windows.Storage.Pickers.FileOpenPicker();
....
picker.FileTypeFilter.Add("*");
Windows.Storage.StorageFile file = await picker.PickSingleFileAsync();
if (file != null)
{
// Application now has read/write access to the picked file
// request 1 - upload small file to user's onedrive
Stream fileStream = await file.OpenStreamForReadAsync();
DriveItem uploadedFile = await graphClient.Me.Drive.Root
.ItemWithPath(file.Path)
.Content
.Request()
.PutAsync<DriveItem>(fileStream);
}