Updating MAPI Properties

Last modified: July 23, 2011

Applies to: Outlook

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";
  2. Call the message's IMAPIProp::SetProps method to set the new message class.

    hRes = lpMessage->SetProps(1, (LPSPropValue) &spvMsgClass, NULL);