저는 Active Directory 계정을 관리하는 도구에 사용될 .NET 클래스에 대해 작업하고 있습니다. 각 계정은 우리가 작업하고있는 계정의 유형에 따라 몇 가지 다른 서버에 위치 할 수있는 네트워크 홈 디렉토리를 갖습니다.원격 폴더를 공유하는 방법은 무엇입니까?
폴더를 만들고 삭제할 수 있지만 폴더를 공유하는 데 문제가 있습니다. I found some code here 내가 원하는 것 같지만 제대로 작동하지 않습니다. 내가 얻는 반환 값은 2이지만, 그것이 무엇을 나타내는 지 모르겠습니다.
테스트 응용 프로그램을 직접 실행 중이므로 공유하려는 폴더와 각 상위 폴더를 완전히 제어 할 수 있으므로 파일 사용 권한 문제가 아닙니다.
다음은 코드 내 (수정) 버전입니다 : 내가 다른 outParams를 출력하려고했습니다
char[] delim = { '\\' };
// folderPath is a string (UNC path)
string[] drivePath = folderPath.Split(delim);
// Create a ManagementClass object
ManagementClass managementClass = new ManagementClass("Win32_Share");
// Create ManagementBaseObjects for in and out parameters
ManagementBaseObject inParams =
managementClass.GetMethodParameters("Create");
ManagementBaseObject outParams;
// Set the input parameters
inParams["Description"] = "";
inParams["Name"] = drivePath[3];
inParams["Path"] = folderPath;
inParams["Type"] = 0x0; // Disk Drive
// Invoke the method on the ManagementClass object
outParams = managementClass.InvokeMethod("Create", inParams, null);
하지만 ReturnValue를 내가 얻을 수있는 모든 것 같습니다.
더 좋은 원격 폴더를 공유하는 다른 방법이 있습니까?