Hi,
"Itay" <it***@nur.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hi All ,
Is there a way to determine whether a folder is being shared with c# ?
Piece of code ( credit to Willy Denoyette)
using(ManagementClass exportedShares = new
ManagementClass("Win32_Share" ))
using(ManagementClass computer = new
ManagementClass("Win32_computersystem" ))
{
string localSystem = null;
ManagementObjectCollection localComputer = computer.GetInstances();
foreach(ManagementObject mo in localComputer)
{
localSystem = mo["Name"].ToString();
}
ManagementObjectCollection shares = exportedShares.GetInstances();
foreach(ManagementObject share in shares)
// dump UNC path
Console.WriteLine(@"UNC path \\{0}\{1}", localSystem, share["Name"]);
}
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation