Exporter (0) Imprimer
Développer tout
EN
Ce contenu n’est pas disponible dans votre langue. Voici la version anglaise.

IADsObjectOptions::SetOption method

The IADsOptions.SetOption method sets a provider-specific option for manipulating a directory object.

Syntax


HRESULT SetOption(
  LONG lnOption,
  VARIANT vValue
);

Parameters

lnOption

Indicates the provider-specific option to set. This parameter can be any value in the ADS_OPTION_ENUM enumeration except ADS_OPTION_SERVERNAME or ADS_OPTION_MUTUAL_AUTH_STATUS.

vValue

Specifies the value to set for the option specified in the lnOption parameter.

Return value

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, see ADSI Error Codes.

Examples

The following code example 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 child 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 code example 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();

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2003

Header

Iads.h

DLL

Activeds.dll

IID

IID_IADsObjectoptions is defined as A1CD2DC6-EFFE-11CF-8ABC-00C04FD8D503

See also

ADSI Error Codes
IADsObjectOptions

 

 

Microsoft réalise une enquête en ligne pour recueillir votre opinion sur le site Web de MSDN. Si vous choisissez d’y participer, cette enquête en ligne vous sera présentée lorsque vous quitterez le site Web de MSDN.

Si vous souhaitez y participer,
Afficher:
© 2014 Microsoft