Metodi della proprietà IADsFileService

I metodi di proprietà dell'interfaccia IADsFileService ottengono o impostano le proprietà descritte nella tabella seguente. Per altre informazioni, vedere Metodi di proprietà dell'interfaccia.

Proprietà

Descrizione

Descrizione del servizio file.

Tipo di accesso: lettura/scrittura

Tipo di dati scripting: BSTR

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

MaxUserCount

Numero massimo di utenti consentiti nel servizio in qualsiasi momento.

Tipo di accesso: lettura/scrittura

Tipo di dati scripting: LONG

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

Commenti

È necessario passare attraverso il servizio file per accedere a condivisioni file, sessioni e risorse in un computer.

Esempio

L'esempio di codice seguente scrive una descrizione per e controlla il limite utente del servizio file.

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

L'esempio di codice seguente scrive una descrizione per e controlla il limite utente per un oggetto servizio file.

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;
}

Requisiti

Requisito Valore
Client minimo supportato
Windows Vista
Server minimo supportato
Windows Server 2008
Intestazione
Iads.h
DLL
Activeds.dll
IID
IID_IADsFileService è definito come A89D1900-31CA-11CF-A98A-00AA006BC149

Vedi anche

IADsService

IADsFileService

IADsFileServiceOperations

IADsServiceOperations

Metodi delle proprietà Interface