Getting Microsoft Graph Drive items by path using the .NET SDK(使用 .NET SDK 通过路径获取 Microsoft Graph Drive 项目)
问题描述
因为它是记录,使用 Microsoft Graph REST API,您可以(在其他选项中)通过 Id 或 Path 获取项目.正如预期的那样,这可以正常工作:
As it is documented, using the Microsoft Graph REST API you can (among other options) get an item by Id or Path. This works fine, as expected:
GET /me/drive/items/{item-id}/children
GET /me/drive/root:/{item-path}:/children
使用 .NET SDK,我可以通过 Id 获取一个文件夹(即第一种情况):
Using the .NET SDK, I can get a folder by Id (i.e. the first case):
var items = await graphClient.Me.Drive.Items[myFolderId].Children.Request().GetAsync();
但是,我找不到如何(使用 .NET SDK)做同样的事情,而是指定一个路径而不是一个 Id(即第二种情况).
However, I couldn't find how (using the .NET SDK) to do the same, but specifying a path instead of an Id (i.e. the second case).
我不想找到我已经知道的路径的 Id 来创建它的请求.对吧?
I don't want to find an Id of a path I already know, to create the request for it. Right?
使用当前的 SDK(Microsoft Graph 客户端库 1.1.1)恐怕无法做到这一点?
I'm afraid is not possible to do this using the current SDK (Microsoft Graph Client Library 1.1.1)?
推荐答案
是这样的:
var items = await graphClient.Me.Drive.Root
.ItemWithPath("/this/is/the/path").Children.Request().GetAsync();
只使用普通路径.不要包含:",也不要包含/drive/root:/".
Use just the plain path. Don't include the ":", and don't include the "/drive/root:/".
很明显,现在我看到了......
it was obvious, now that I see it...
这篇关于使用 .NET SDK 通过路径获取 Microsoft Graph Drive 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 .NET SDK 通过路径获取 Microsoft Graph Drive 项目


基础教程推荐
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01