Platform SDK: Active Directory, ADSI, and Directory Services |
The IADsOptions::SetOption method sets the provider-specific options for manipulating a directory object.
HRESULT IADsObjectOptions::SetOption( DWORD dwOption, void *pValue) );
The method supports the standard return values, including S_OK for a successful operation and E_ADS_BAD_PARAMETER when the user has supplied an invalid pValue parameter. For other return values, see ADSI Error Codes.
The following Visual Basic® code snippet shows how to set options on a container object to enable paged search and referral chasing.
Const ADS_CHASE_REFERRALS_SUBORDINATE = &H20 Dim cont As IADsContainer Dim chaseRef As Variant Dim opt As IADsObjectOptions Set cont = GetObject("LDAP://DC=Sales,DC=Microsoft,DC=com") Set opt = cont 'Set the referral and page size and then enumerate all the children objects. chaseRef = ADS_CHASE_REFERRALS_SUBORDINATE PageSize = 100 opt.SetOption ADS_OPTION_REFERRALS, chaseRef opt.SetOption ADS_OPTION_PAGE_SIZE, PageSize For Each child In cont Debug.Print child.Name Next
The following C++ code snippet sets options on a container object to enable paged search and referral chasing.
IADsContainer *pCont; IADsObjectOptions *pOps; LPWSTR adsPath = L"LDAP://OU=Sales,DC=Microsoft,DC=com"; HRESULT hr =S_OK; hr = ADsGetObject(adsPath,IID_IADsContainer,(void**)&pCont); if(FAILED(hr)) exit(hr); hr = pCont->QueryInterface(IID_IADsObjectOptions,(void**)&pOps); pCont->Release(); VARIANT var; VariantInit(&var); V_I4(&var)=ADS_CHASE_REFERRALS_SUBORDINATE; V_VT(&var)=VT_I4; hr = pOps->SetOption(ADS_OPTION_REFERRALS,var); VariantClear(&var); V_I4(&var)=100; V_VT(&var)=VT_I4; hr = pOps->SetOption(ADS_OPTION_PAGE_SIZE, var); VariantClear(&var); pOps->Release();
Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with DSClient).
Windows 95/98: Requires Windows 95 or later (with DSClient).
Header: Declared in Iads.h.