How to access a Windows 10 Device in C#

514 Views Asked by At

When you plug in (via USB) a mobile phone into a Windows 10 laptop, it comes up as a device. How do I access the files on this in C#. For example an iPhone when plugged in shows like this:

Windows 10 devices with iPhone plugged in

I would like to get all of the data off of that. I have already tried using the paths 'This PC\Apple iPhone\Internal Storage' and '\This PC\Apple iPhone\Internal Storage', both crashed the programming saying that they could not find the files.

I am then going to read and copy files off this in C#

Note: I would like this to work for all types of phone, not just an iPhone (Android and iPhone would be fine though).

1

There are 1 best solutions below

1
MoltenCore On

The real problem you're trying to resolve is to access a device through the MTP protocol. The question has been asked before on SO.

You can try to use Windows Portable Device API directly (I'm assuming this is windows due to the screenshot).

Another option would be using the MediaDevices NuGet package like the linked answer does.