【发布时间】:2015-03-16 15:25:25
【问题描述】:
我必须与用户共享一个文件夹并使用 c# 以编程方式取消共享它。 我可以使用 Win32_Share 类的 InvokeMethod 共享文件夹。
int IsShared = 0;
ManagementClass mc = new ManagementClass("Win32_Share");
object[] methodargs = { folderPath, shareName, "0" };
object result = mc.InvokeMethod("Create", methodargs);
if ((uint)result != 0)
{
IsShared = 1;
return IsShared;
}
else
return IsShared;
但是如何为特定用户做呢?
另外请告诉我如何取消分享? Win32_Share 类有 delete() 方法。但我无法使用它取消共享。
【问题讨论】: