Account disabilitato (provider LDAP)
Per disabilitare un account utente, impostare la proprietà AccountDisabled su TRUE nell'interfaccia IADsUser. Questo è simile al provider WinNT. Gli esempi di codice seguenti illustrano come disabilitare un account utente.
Esempio 1
Dim usr As IADsUser
On Error GoTo Cleanup
Set usr = GetObject("LDAP:// CN=JeffSmith, OU=Sales, DC=Fabrikam, DC=Com")
usr.AccountDisabled = TRUE ' Disable the account.
usr.SetInfo
Cleanup:
If (Err.Number<>0) Then
MsgBox("An error has occurred. " & Err.Number)
End If
Set usr = Nothing
Esempio 2
IADsUser *pUser = NULL;
HRESULT hr = S_OK;
LPWSTR adsPath;
adsPath=L"LDAP://serv1/cn=Jeff Smith,cn=Users, dc=Fabrikam, dc=com";
hr = ADsGetObject(adsPath,IID_IADsUser,(void**)&pUser);
if(FAILED(hr)){return;}
hr = pUser->put_AccountDisabled(true);
hr = pUser->SetInfo();