Directory Services |
The property methods of the IADsFileshare interface get or set the properties described in the following table. For more information, see Interface Property Methods.
Property | Description |
---|---|
CurrentUserCount
[Visual Basic] [C++] |
The number of users connected to the share. |
Description
[Visual Basic] [C++] |
The description of the file share. |
HostComputer
[Visual Basic] [C++] |
An ADsPath reference to the host computer. |
MaxUserCount
[Visual Basic] [C++] |
The maximum number of users allowed to access the share at one time. |
Path
[Visual Basic] [C++] |
The file system path to the shared directory. |
To access the properties of file shares on a computer, you must first bind to the "LanmanServer" on the machine. The following code example shows how to set up the description and the maximum number of allowed users for all the public file shares on the computer, named as "myMachine", in the default domain.
Dim fs As IADsFileService Dim share As IADsFileShare On Error GoTo Cleanup Set fs = GetObject("WinNT://myMachine/LanmanServer") If (fs.class = "FileService") Then For Each share In fs share.description = share.name & " is my working folder." share.MaxUserCount = 10 share.SetInfo Next share End if Cleanup: If (Err.Number<>0) Then MsgBox("An error has occurred. " & Err.Number) End If Set fs = Nothing Set share = Nothing
The following code example shows how to make the existing C:\MyFolder directory a public file share.
Dim fs As IADsFileShare Dim cont As IADsContainer On Error GoTo Cleanup Set cont = GetObject("WinNT://yourDomain/yourMachineName/LanmanServer") Set fs = cont.Create("FileShare", "Public") Debug.Print fs.Class fs.Path = "C:\MyFolder" fs.SetInfo Cleanup: If (Err.Number<>0) Then MsgBox("An error has occurred. " & Err.Number) End If Set cont = Nothing Set fs = Nothing
The following code example makes the existing C:\MyFolder directory a public file share.
IADsFileShare *pShare = NULL; IADsContainer *pCont = NULL; LPWSTR adsPath = L"WinNT://yourMachineName/LanmanServer"; HRESULT hr = S_OK; hr = ADsGetObject(adsPath, IID_IADsContainer,(void**)&pCont); if(FAILED(hr)) {goto Cleanup;} hr = pCont->Create(CComBSTR("FileShare"), CComBSTR("Public"), (IDispatch**)&pShare); if(FAILED(hr)) {goto Cleanup;} hr = pShare->put_Path(CComBSTR("c:\\public")); if(FAILED(hr)) {goto Cleanup;} hr = pShare->SetInfo(); Cleanup: if(pCont) pCont->Release(); if(pShare) pShare->Release();
Client: Included in Windows XP and
Windows 2000 Professional.
Server: Included in Windows Server 2003 and
Windows 2000 Server.
Redistributable: Requires Active Directory Client Extension
on Windows NT 4.0 SP6a and Windows 95/98/Me.
Header: Declared in Iads.h.