Last modified: July 23, 2011

Applies to: Outlook

Adds one or more properties of type PT_OBJECT to the object.

HRESULT HrAddObjProps(
  LPSPropTagArray lpPropTagArray,
  LPSPropProblemArray FAR * lppProblems


[in] A pointer to an array of property tags that indicate the properties to add.


[in, out] On input, a valid pointer to an SPropProblemArray structure, or NULL. On output, a pointer to a pointer to a structure that contains 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.


The properties were successfully added.


A property type other than PT_OBJECT was passed in the array that the lpPropTagArray parameter points to.


The object has been set not to allow read/write permission.


Some, but not all, of the properties were added.

The IPropData::HrAddObjProps method adds one or more properties of type PT_OBJECT to the object. HrAddObjProps provides an alternative to the IMAPIProp::SetProps method 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 that the IMAPIProp::GetPropList method returns.

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 permission. If HrAddObjProps returns MAPI_E_NO_ACCESS, you cannot add properties to the object because it does not permit modification. To obtain read/write permission to an object prior to calling HrAddObjProps, call IPropData::HrSetObjAccess and set the ulAccess parameter to IPROP_READWRITE.