Is there a way through the .net framework to determine if a folder is shared or not?
Neither Diretory, DirectoryInfo or FileAttributes seem to have any corresponding
One more way to skin this cat is to use powershell (if you have it installed) to invoke the wmi call, include a reference to System.Management.Automation, it will most likley be in \program files\reference assemblies\microsoft\windowspowershell
private void button1_Click(object sender, EventArgs e)
{
Runspace rs = RunspaceFactory.CreateRunspace();
rs.Open();
Pipeline pl = rs.CreatePipeline();
pl.Commands.AddScript("get-wmiobject win32_share");
StringBuilder sb = new StringBuilder();
Collection list = pl.Invoke();
rs.Close();
foreach (PSObject obj in list)
{
string name = obj.Properties["Name"].Value as string;
string path = obj.Properties["Path"].Value as string;
string desc = obj.Properties["Description"].Value as string;
sb.AppendLine(string.Format("{0}{1}{2}",name, path, desc));
}
// do something with the results...
}