Please help.

  • Thread starter Thread starter Anil
  • Start date Start date
A

Anil

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 ?
 
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.
 
Back
Top