问题描述
我能够在Office 365的xxx.sharepoint.com团队网站下获取IT文件夹的云端硬盘对象
var drives = await graphClient.Sites["xxx.sharepoint.com"].Drives.Request().GetAsync();
//// Get https://xxx.sharepoint.com/IT drive
var driveIT = drives.CurrentPage.Where(d => d.DriveType == "documentLibrary" && d.Name == "IT").FirstOrDefault();
而且,我能够在该IT文件夹下获取test.txt文件的DriveItem对象
var testfile = await graphClient.Sites["xxx.sharepoint.com"].Drives[driveIT.Id].Root.ItemWithPath("test.txt").Request().GetAsync();
但是,当我尝试下载内容时,出现此错误
代码:invalidRequest 消息:提供的标识符格式错误-网站集ID无效
// this cause the error
var streamtest = await graphClient.Sites["xxx.sharepoint.com"].Drives[driveIT.Id].Root.ItemWithPath("test.txt").Content
.Request()
.GetAsync();
// this also cause the same error.
//var streamtest = await graphClient.Sites["xxx.sharepoint.com"].Drives[driveIT.Id].Items[$"{testfile.Id}"].Content
// .Request()
// .GetAsync();
但是,我可以在我的IT文件夹下上传一个文本文件。
var uploadFile1 =等待graphClient.Sites [“ xxx.sharepoint.com”]。Drives [driveIT.Id] .Root.ItemWithPath(“ New_testupload_msgraph.txt”)。Content.Request()。PutAsync(stream1);
而且,我能够将测试文件上传到OneDrive或从中下载测试文件
var uploadedFile1 = await graphClient.Sites["xxx.sharepoint.com"].Drives[driveIT.Id].Root.ItemWithPath("New_testupload_msgraph.txt").Content.Request().PutAsync<DriveItem>(stream1);
var dlteststream = await graphClient.Me.Drive.Items["01JZT44T6EFIIYDTEEJNHLPJGYC3A4VO2H"].Content.Request().GetAsync();
任何机构都可以帮助解决此问题吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)