Platform SDK: Active Directory, ADSI, and Directory Services

IADsNamespaces Property Methods

The property methods of the IADsNamespaces interface get and set the properties described in the following table. For general discussions of property methods, see Interface Property Methods.

Properties in Vtable Order

Property Description
DefaultContainer

[Visual Basic]
Access: Read/Write
Data Type: BSTR

[C++]
HRESULT get_Default
([out] BSTR *pbstrDefault);


HRESULT put_Default
([in] BSTR bstrDefault);

The DefaultContainer property is an ADsPath name that identifies a base container object to which you can bind. This base container provides the starting point from which user begins browsing. ADSI defines the DefaultContainer property to provide a quick way of getting a pointer to a previously defined ADSI container object. Providers need to supply this property on a "per-user" basis. The default container is set immediately after the invocation of IADsNamespaces::put_DefaultContainer. SetInfo does not have to be called. In fact, the system-supplied namespaces object returns E_NOTIMPL for the SetInfo method called on this object.

Remarks

When a container is the namespaces object, an enumeration operation always results in a list of provider-specific namespace objects. When IADsContainer::GetObject is used to obtain a namespace object, the bstrClass parameter will be ignored. This is because the container, that is, the namespaces object, contains only one type of objects, namely, provider-specific namespace objects.

Example Code [Visual Basic]

The following Visual Basic code snippet shows how to set the default container of the namespaces object.

Dim ns as IADsNamespaces
Set ns = GetObject("ADs:")
ns.DefaultContainer = "WinNT://Fabrikam/Sales"
'do other stuff

Example Code [C++]

The following C++ code snippet shows how to set the default container of the namespaces object.

IADsNamespaces *pNs;
HRESULT hr;
hr = ADsGetObject(L"ADs:",
                  IID_IADsNamespaces,
                  (void**)pNs);
VARIANT var;
VariantInit(&var);
V_BSTR(&var) = SysAllocString(L"WinNT://Fabrikam/Sales");
V_VT(&var) = VT_BSTR;
pNs->put_DefaultContainer(var);
VariantClear(&var);
 
// Do other stuff

See Also

IADsNamespaces