Platform SDK: Active Directory, ADSI, and 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 in Vtable Order

Property Description
Description

[Visual Basic]
Access: Read/Write
Data Type: 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
Data Type: 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 Visual Basic code snippet writes a description for and check the user limit of the file service.

Dim fs As IADsFileService

'  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 

Example Code [C++]

The following C++/C code snippet writes a description for and check the user limit on a file service object.

HRESULT CheckFileService()
{
    IADsFileService *pFs;
    LPWSTR adsPath = L"WinNT://myComputer/LanmanServer";
    HRESULT hr;
    hr = ADsGetObject(adsPath, IID_IADsFileService, (void**)&pFs)
    if (FAILED(hr)) return hr;
    hr = pFs->put_Description(L"WinNT File Service");
    hr = pFs->SetInfo();

    long count;
    hr = pFs->get_MaxUserCount(&count);
    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);
    }
    return S_OK;
}

See Also

IADsService, IADsFileService, IADsFileServiceOperations, IADsServiceOperations, Interface Property Methods