DIWbemServices.OpenNamespace

[This is preliminary documentation and subject to change.]

The DIWbemServices.OpenNamespace method provides the caller with a new DIWbemServices object that has the specified child namespace as its operating context. All operations through the new object, such as class or instance creation, only affect that namespace. The namespace must be a child namespace of the current object through which this method is called.

DIWbemServices.OpenNamespace(
  [in]  Namespace As String,               
  [in]  lFlags As Long,                  
  [in] pCtx As Object,              
  [out, OPTIONAL] ppWorkingNamespace As Object,  
  [out, OPTIONAL] ppResult As Object  
) As Long
 

Parameters

Namespace
The object path to the target namespace. See Namespaces. This namespace can only be relative to the current namespace associated with the DIWbemServices interface object. It cannot be an absolute path. This parameter cannot be vbNullString.
lFlags
Reserved. It must be zero.
pCtx
Reserved. It must be NOTHING.
ppWorkingNamespace
Receives the object representing the new namespace context. If you specify this parameter, ppResult must be set toNOTHING.
ppResult
Typically NOTHING. If not NOTHING, ppWorkingNamespace must be NOTHING. In this case, the parameter receives a new DIWbemCallResult object, and the call returns immediately. Then, you can periodically poll the DIWbemCallResult.GetResultServices method until the requested namespace becomes available. This parameter is set to NOTHING on error and a new object is not returned.

IMPORTANT If you use this parameter, DCOM requires that ppResult must be set to NOTHING before you call the method.  

Return Values

WBEM_E_ACCESS_DENIED The user does not have permission to access the requested context.
WBEM_E_FAILED Unspecified error.
WBEM_E_INVALID_NAMESPACE The specified namespace does not exist.
WBEM_E_INVALID_PARAMETER An invalid parameter was specified, or the namespace could not be parsed.
WBEM_E_OUT_OF_MEMORY There was not enough memory to complete the operation.
WBEM_NO_ERROR Success.

For more information on return values see Visual Basic error handeling and return values

Remarks

You can also use DWbemLocator.ConnectServer to open the same namespace. The only difference is that the OpenNamespace method allows you to place relative object paths in the Namespace parameter so you can open child namespaces recursively. DWbemLocator.ConnectServer requires a full object path. See Object Paths.

For example, if Root is the current namespace associated with the DIWbemServices interface object, using Default in the Namespace parameter yields a new object bound to the \Root\Default namespace.

See Also

Error Objects, DWbemLocator.ConnectServer, Namespaces