Directory Services

IADsFileService Property Methods

The property methods of the IADsFileService interface get or set the properties described in the following table. For more information, see Interface Property Methods.

Properties

Property Description
Description

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_Description
([out] BSTR* pbstrDescription);
HRESULT put_Description
([in] BSTR bstrDescription);

The description of the file service.
MaxUserCount

[Visual Basic]
Access: Read/Write
DataType: Long

[C++]
HRESULT get_MaxUserCount
([out] LONG* plMaxUserCount);
HRESULT put_MaxUserCount
([in] LONG lMaxUserCount);

The maximum number of users allowed on the service at any time.

Remarks

You must go through the file service to access file shares, sessions, and resources on a computer.

Example Code [Visual Basic]

The following code example writes a description for and check the user limit of the file service.

Dim fs As IADsFileService
On Error GoTo Cleanup

' Bind to a file service object on "myComputer" in the local domain.
Set fs = GetObject("WinNT://myComputer/LanmanServer")

fs.Description = "WinNT file service."
n = fs.MaxUserCount
If n = -1 Then
   MsgBox "No limit has been imposed on number of users allowed."
Else
   MsgBox n & " users are allowed."
End If

Cleanup:
	If (Err.Number<>0) Then
		MsgBox("An error has occurred. " & Err.Number)
	End If
	Set fs = Nothing

Example Code [C++]

The following code example writes a description for and check the user limit on a file service object.

HRESULT CheckFileService()
{
	IADsFileService *pFs = NULL;
	LPWSTR adsPath = L"WinNT://myComputer/LanmanServer";
	HRESULT hr = S_OK;
	long count = 0;

	hr = ADsGetObject(adsPath, IID_IADsFileService, (void**)&pFs)
	if(FAILED(hr)) {goto Cleanup;}

	hr = pFs->put_Description(CComBSTR("WinNT File Service"));
	if(FAILED(hr)) {goto Cleanup;}

	hr = pFs->SetInfo();
	if(FAILED(hr)) {goto Cleanup;}

	hr = pFs->get_MaxUserCount(&count);
	if(FAILED(hr)) {goto Cleanup;}

	if(count == -1) {
		printf("No limit has been imposed on the number of users.\n");
} 
	else {
		printf("Number of allowed users are %d\n",count);
}

Cleanup:
	if(pFs) pFs->Release();
	return S_OK;
}

Requirements

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.

See Also

IADsService, IADsFileService, IADsFileServiceOperations, IADsServiceOperations, Interface Property Methods