Platform SDK: MAPI

IPropData::HrAddObjProps

The IPropData::HrAddObjProps method adds one or more properties that are of type PT_OBJECT to the object.

Quick Info

See IPropData : IMAPIProp.

HRESULT HrAddObjProps(
  LPSPropTagArray lpPropTagArray,        
  LPSPropProblemArray FAR * lppProblems  
);
 

Parameters

lpPropTagArray
[in] Pointer to an array of property tags indicating the properties to add.
lppProblems
[in, out] On input, a valid pointer to an SPropProblemArray structure, or NULL. On output, a pointer to a pointer to a structure that holds information about properties that could not be added, or NULL. A pointer to a property problem array structure is returned only if a valid pointer is passed in.

Return Values

S_OK
The properties were successfully added.
MAPI_E_INVALID_TYPE
A property type other than PT_OBJECT was passed in the array pointed to by the lpPropTagArray parameter.
MAPI_E_NO_ACCESS
The object has been set not to allow read/write access.
MAPI_W_PARTIAL_COMPLETION
Some, but not all, of the properties were added.

Remarks

The IPropData::HrAddObjProps method adds one or more properties that are type PT_OBJECT to the object. HrAddObjProps provides an alternative to IMAPIProp::SetProps for object properties because object properties cannot be created by calling SetProps. Adding an object property results in the property tag being included in the list of property tags retrieved through IMAPIProp::GetPropList.

Notes to Callers

If HrAddObjProps returns MAPI_W_PARTIAL_COMPLETION and you have set lppProblems to a valid pointer, check the returned SPropProblemArray structure to find out which properties were not added. Typically, the only problem that occurs is lack of memory. Free the SPropProblemArray structure by calling the MAPIFreeBuffer function when you are finished with it.

To add a property, the target object must have read/write access. If HrAddObjProps returns MAPI_E_NO_ACCESS, this indicates that you cannot add properties to the object because it does not permit modification. To obtain read/write access to an object prior to calling HrAddObjProps, call IPropData::HrSetObjAccess and set the ulAccess parameter to IPROP_READWRITE.

See Also

MAPIFreeBuffer, SPropProblemArray, SPropTagArray