Jan Martin
Jan Martin

Reputation: 309

How can I tell if a driveItem is a folder?

I am trying to show an icon for driveItems, in most cases this works by just getting the extension part of the driveItem name.

However, I have files with no extensions, and folders (with no extensions) showing up as the same icon.

Is there a good way using the dotnet Graph SDK to determine if a driveItem is a folder?

Upvotes: 0

Views: 1565

Answers (1)

user2250152
user2250152

Reputation: 20635

driveItem resource has properties folder and file.

folder property is set if the item is a folder.

file property is set if the item is a file.

To determine if the items is either a folder or a file for dotnet Graph SDK check properties folder and file if their are null or have value.

Resources:

driveItem properties

Upvotes: 2

Related Questions