How do I open a Windows 7 Library like Documents
, Pictures
, Music
, Videos
and all other custom libraries from my app?
I tried opening explorer.exe Libraries\Documents
but it doesn't work.
Find the AppData directory:
Dim appData As String = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
Find the documents shortcut and open it in explorer:
For Each file As String In Directory.GetFiles(appData, "Documents.library-ms", SearchOption.AllDirectories)
Process.Start(file)
Next
Look at this to see how the most common actions are performed on Windows 7 libraries.
Edit:
The sample uses the Windows API Code Pack for Micorosoft .Net Framework [ edit 2015-09-24: previous link is dead - use this SO entry to locate the necessary Nuget packages ] (thanks MarkJ for pointing out that the link should be there).
As for David Heffernan's question ...
You use the assign the ShellLibrary
object to the DefaultDirectoryShellContainer
property of an Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialog
(e.g. the Microsoft.WindowsAPICodePack.Dialogs.CommonOpenFileDialog
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With