Updating MAPI properties

Applies to: Outlook 2013 | Outlook 2016

Clients and service providers can update a property value by calling:

  • An object's IMAPIProp::SetProps method to update the value of one or more of an object's properties.

  • The HrSetOneProp function to update only one property at a time. Use HrSetOneProp only if the target object is local; this function can cause performance degradation when used with remote objects.

The following procedure illustrates how to use SetProps to update the message class, or PR_MESSAGE_CLASS_A (PidTagMessageClass) property, of a message.

To update the message class of a message

  1. Allocate an SPropValue structure for the message class and set its members as appropriate.
  SPropValue spvMsgClass;
  spvMsgClass.ulPropTag = PR_MESSAGE_CLASS_A;
  spvMsgClass.Value.lpszA = "IPM.NewClass";
  
  1. Call the message's IMAPIProp::SetProps method to set the new message class.
  hRes = lpMessage->SetProps(1, (LPSPropValue) &spvMsgClass, NULL);

See also