Jay Dave
Jay Dave

Reputation: 981

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

I am coding against the OneDrive C# SDK and I am trying to see if the Microsoft.OneDrive.Sdk.Itemclass has any property where it states if an item is a Folder or a File?

I took a look in the Item class in the Microsoft.OneDrive.Sdk namespace but nothing popped out to me.

Upvotes: 1

Views: 361

Answers (2)

dabox
dabox

Reputation: 134

For the C# SDK, you can determine it by the item's property Folder and File

Upvotes: 0

Ondrej Tucny
Ondrej Tucny

Reputation: 27964

It is distinguised by the following properties:

  • a folder has the Folder property non-null
  • a file has the File property non-null

See the Item class source and the underlying API's documentation stating:

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.

Upvotes: 2

Related Questions