OneDrive CSharp SDK 和 OneDrive REST API - 如何确定文档是文件还是文件夹?

OneDrive CSharp SDK and OneDrive REST API - how to determine if a document is a file or folder?

我正在针对 OneDrive C# SDK 进行编码,我正在尝试查看 Microsoft.OneDrive.Sdk.Itemclass 是否有任何 属性 说明项目是文件夹还是一份文件?

我查看了 Microsoft.OneDrive.Sdk 命名空间中的 Item class,但没有弹出任何内容。

它具有以下属性:

  • 一个文件夹有 Folder 属性 non-null
  • 一个文件具有 File 属性 non-null

参见 Item class source and the underlying API's documentation 声明:

Items have Facets that provide data about the item's identities and capabilities. Folders have a folder facet and files have a file facet. Images have an image facet in addition to their file facet.

对于C#SDK,可以通过item的属性 Folder and File

来判断