IWbemServices::PutInstance

[This is preliminary documentation and subject to change.]

The IWbemServices::PutInstance method creates or updates an instance of a class object to CIMOM.

HRESULT IWbemServices::PutInstance(
  [in] IWbemClassObject *pInst,           
  [in] LONG lFlags,                      
  [in] IWbemContext *pCtx,                       
  [out, OPTIONAL] IWbemCallResult **ppCallResult  
);
 

Parameters

pInst
Points to the instance to be written to the database. The caller cannot make assumptions about the reference count at the completion of this call. The operating system can call AddRef to the pointer, or leave the reference count unchanged.
lFlags
If WBEM_FLAG_CREATE_OR_UPDATE, the instance is created if it does not exist, or it is overwritten if it exists already. If WBEM_FLAG_UPDATE_ONLY, then the instance must exist, and this call constitutes an update. If WBEM_FLAG_CREATE_ONLY, then this call is for creation only, and the call fails if the instance already exists.
pCtx
Typically NULL. Otherwise, this is a pointer to an IWbemContext 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 NULL, this is not used. If not NULL, call returns immediately with WBEM_NO_ERROR. An object of type IWbemCallResult is then returned. It can be polled for the result of the operation through the IWbemCallResult::GetCallStatus method. The IWbemCallResult::GetResultString contains the object path assigned to the object. When the returned object is no longer required, it must be deallocated using Release.

Return Values

WBEM_E_ACCESS_DENIED The current user does not have permission to update an instance of the specified class.
WBEM_E_ALREADY_EXISTS WBEM_FLAG_CREATE_ONLY flag was specified, but the instance already exists.
WBEM_E_FAILED Other unspecified errors.
WBEM_E_ILLEGAL_NULL A NULL value was specified for a property that may not be NULL, such as one that is marked by a key, indexed, or not_null qualifier.
WBEM_E_INVALID_OBJECT The specified instance is invalid (for example, PutInstance with a Class will invoke this return).
WBEM_E_INVALID_PARAMETER An invalid parameter was specified, or the namespace could not be parsed.
WBEM_E_NOT_FOUND WBEM_FLAG_UPDATE_ONLY flag was specified, but the instance does not exist.
WBEM_E_OUT_OF_MEMORY There was not enough memory to complete the operation.
WBEM_E_TRANSPORT_FAILURE The communications link between the client and CIMOM has failed.
WBEM_NO_ERROR The call succeeded.

See Also

IWbemCallResult, IWbemServices::PutInstanceAsync, Instance Creation and Modification Rules