[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
IMPORTANT If you use this parameter, DCOM requires that ppResult must be set to NOTHING before you call the method.
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
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.
Error Objects, DWbemLocator.ConnectServer, Namespaces