Ign*_*tus 1 onedrive microsoft-graph-sdks
.NET毛伊岛应用程序,
我正在尝试从 Drive 上的根文件夹获取子级列表...当我使用 MS Learn 中的代码片段时,我在编辑/编译时收到此错误:
“DriveRequestBuilder”不包含“Root”的定义,并且找不到接受“DriveRequestBuilder”类型的第一个参数的可访问扩展方法“Root”(您是否缺少 using 指令或程序集引用?)
我刚刚克隆了一个由微软员工开发的示例项目,并插入了来自 MS Learn 的一段代码。
请在此处获取出现错误的整个项目:
https://github.com/leoderja/DriveRequestBuilder_RootNotDefined.git
错误在于:
MauiAppBasic.csproj 项目 ->
MSALClient 文件夹 -> MSGraphHelper.cs 文件 -> TestRootChildrenAsync 方法
使用 Microsoft.Graph 版本 5.0.0-rc.1
版本:这是一个最小的例子:
using Microsoft.Graph;
GraphServiceClient graphClient = new GraphServiceClient(new HttpClient());
var children = await graphClient.Me.Drive.Root.Children.Request().GetAsync();
Run Code Online (Sandbox Code Playgroud)
问题是 Microsoft.Graph v5.00 rc1。当我设置 v4.50 时,错误消失了。我希望 Microsoft 工作人员在 v5 最终版本发布时更新文档并进行更改。
小智 8
希望这可以节省我花几个小时寻找的时间。目前正确答案是:
var children = await client.Drives[driveItem.Id].Items["root"].Children.GetAsync();
Run Code Online (Sandbox Code Playgroud)
请参阅https://github.com/microsoftgraph/msgraph-sdk-dotnet/issues/1737
| 归档时间: |
|
| 查看次数: |
2317 次 |
| 最近记录: |