Directory Services

IADsCollection::Add

The IADsCollection::Add method adds a named item to the collection.

HRESULT Add( 
  BSTR bstrName,
  VARIANT varItem
);

Parameters

bstrName
[in] The BSTR value that specifies the item name. IADsCollection::GetObject and IADsCollection::Remove reference the item by this name.
varItem
[in] Item value. When the item is an object, this parameter holds the IDispatch interface pointer on the object.

Return Values

This method supports the standard return values, as well as the following.

For more information and other return values, see ADSI Error Codes.

Return Code Description
S_OK The named item was added successfully.
E_NOTIMPL The method is not supported.

Remarks

Collections for a directory service can also consist of a set of immutable objects.

This method is not supported in any of the ADSI system providers.

Requirements

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.

See Also

IADsCollection::GetObject, IADsCollection::Remove, ADSI Error Codes, ADSI System Providers, IDispatch