Search code examples
c#.netshared-directory

C# .Net 4 Retrieve shared folders


I'm creating a WPF file explorer treeview (in C# 4) and I need it to work with UNC. For example, lets say I have these shared networks folders:

\\share\test1
\\share\test2
\\share\test3
\\share\test4

If I only have \\share, how can I determine what shared folders are within that path? \share is not a shared folder in and of itself.


Solution

  • Take a look at http://www.codeproject.com/KB/IP/networkshares.aspx. This contains an explanation with working source code.