DIWbemServices.PutClass

[This is preliminary documentation and subject to change.]

The DIWbemServices.PutClass method creates a new class, or it updates an existing one. The class specified by the pObject parameter must have been correctly initialized with all of the required property values.

You may not create classes with names that begin with two leading underscores because names such as this are reserved for system classes.

DIWbemServices.PutClass(
  [in] pObject As Object,                
  [in] lFlags As Long,                             
  [in] pCtx As Object,                       
  [out, OPTIONAL] ppCallResult As Object  
) As Long
 

Parameters

pObject
Must be a valid DWbemClassObject class definition.
lFlags
If WBEM_FLAG_CREATE_OR_UPDATE, the class is created if it does not exist or overwritten if it already exists. If WBEM_FLAG_UPDATE_ONLY, the class must exist and this call constitutes an update. If WBEM_FLAG_CREATE_ONLY, this call is for creation only, and the call fails if the class already exists.
pCtx
Typically NOTHING. Otherwise, this is a DWbemContext object required by the dynamic class provider that is producing the class instances. The values in the context object must be specified in the documentation for the provider in question.
ppCallResult
If not NOTHING, the call returns immediately with WBEM_NO_ERROR. Then, you must poll DIWbemCallResult for the result by using DIWbemCallResult.GetCallStatus.

Return Values

WBEM_E_ACCESS_DENIED The current user is not permitted to create or modify classes.
WBEM_E_FAILED Unspecified error.
WBEM_E_INCOMPLETE_CLASS Required properties for classes have not all been set.
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.
WBEM_E_ALREADY_EXISTS WBEM_FLAG_CREATE_ONLY flag was specified, but the class already exists.
WBEM_E_NOT_FOUND Update flag specified, but class is not found.

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

See Also

Class Creation and Modification Rules, Error Objects, DIWbemCallResult