2

I am writing an app to get pictures off of a camera, and want to open an OpenFileDialog with its InitialDirectory set to be the camera.

This works fine:

openFileDialog.InitialDirectory = "c:\\someFolder\\";

But these do not:

openFileDialog.InitialDirectory = "CameraName\\";
openFileDialog.InitialDirectory = "My Computer\\CameraName\\";

I assume it is because it is an MTP device, and that's not its "real directory name". Is there any way to accomplish this?

Thanks

Matt
  • 5,461
  • 7
  • 36
  • 43

2 Answers2

2

As far as I know, it is not possible to accomplish this, at least not with .NET IO operations, because MTP devices do not conform to basic I/O operations (read/write).

Here you have to either find some way to force map the MTP device storage with a drive letter (Seen a guy once trying to accomplish this, not sure where he got), or simply remove the SD card and connect it directly to the PC.

Sorry that I couldn't help you much.

Radhi
  • 125
  • 6
0

Had the same problem and found How to construct path for mtp devices (usable in folder browse dialog)?

When I insert "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" (which there they say is "my computer") as InitialDirectory, it will actually show the MTP folder :)

Florian Straub
  • 826
  • 9
  • 18