all groups > dotnet faqs > march 2004 >
You're in the

dotnet faqs

group:

Please help.


Please help. Anil
3/27/2004 4:24:46 PM
dotnet faqs: I need to know whether .Net provides methods/classes for displaying shared
folders of a device.
One way to solve this problem is to import Win32 dlls ,but is there a direct
way provided by .Net by which all the user level shared folders can be
displayed ?

Re: Please help. Willy Denoyette [MVP]
3/28/2004 3:10:42 PM
Take a look at the System.Management namespace.
Something like this will do...

using System.Management;
.....

using(shares = new ManagementClass("Win32_Share" ))
{
ManagementObjectCollection moc = shares.GetInstances();
foreach(ManagementObject mo in moc)
// dump share name and path
Console.WriteLine("{0} - {1}",mo["Name"],mo["Path"]);
}

Willy.

[quoted text, click to view]

AddThis Social Bookmark Button