使用.NET SDK按路径获取Microsoft Graph Drive项目

hor*_*ioj 3 c# onedrive microsoft-graph

文档所述,使用Microsoft Graph REST API,您可以(除其他选项外)通过Id或Path获取项目。可以正常工作,如预期的那样:

GET /me/drive/items/{item-id}/children
GET /me/drive/root:/{item-path}:/children
Run Code Online (Sandbox Code Playgroud)

使用.NET SDK,我可以按ID(即第一种情况)获取文件夹:

var items = await graphClient.Me.Drive.Items[myFolderId].Children.Request().GetAsync();
Run Code Online (Sandbox Code Playgroud)

但是,我找不到方法(使用.NET SDK)执行相同操作,而是指定了路径而不是ID(即第二种情况)。

我不想找到我已经知道的路径的ID,以为其创建请求。对?

恐怕无法使用当前的SDK(Microsoft Graph Client Library 1.1.1)来做到这一点?

hor*_*ioj 5

这是这样的:

var items = await graphClient.Me.Drive.Root
                  .ItemWithPath("/this/is/the/path").Children.Request().GetAsync();
Run Code Online (Sandbox Code Playgroud)

仅使用普通路径。不要包含“:”,也不要包含“ / drive / root:/”。

很明显,现在我看到了...