UWP Application - How to detect a CDRom or DVDRom device in StorageDevices

133 Views Asked by At

In a UWP application, I obtain all the removable devices with :

KnownFolders.RemovableDevices.GetFoldersAsync()

I want to exclude optical devices and keep only the external hard disk or flash devices.

I tried to find a suitable property by using the following :

device.Properties.RetrievePropertiesAsync(...)

and tried a lot of properties from here but can't fin anything.

Anybody have an idea?

1

There are 1 best solutions below

1
Xie Steven On

You could build an AQS filter string when you enumerate devices. See Build a device selector.

If you are not familiar with the AQS format, you can read more at Using Advanced Query Syntax Programmatically.