Directory Services |
The IADsOptions::SetOption method sets a provider-specific option for manipulating a directory object.
HRESULT SetOption( LONG lnOption, VARIANT vValue );
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 more information about other return values, see ADSI Error Codes.
The following Visual BasicĀ® code 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=Fabrikam,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 sets options on a container object to enable paged search and referral chasing.
IADsContainer *pCont; IADsObjectOptions *pOps; LPWSTR adsPath = L"LDAP://OU=Sales,DC=Fabrikam,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();
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.