更新 MAPI 属性
适用于:Outlook 2013 | Outlook 2016
客户端和服务提供商可以通过调用以下方法更新属性值:
对象的 IMAPIProp::SetProps 方法,用于更新对象的一个或多个属性的值。
HrSetOneProp 函数一次只更新一个属性。 仅当目标对象为本地时,才使用 HrSetOneProp ;与远程对象一起使用时,此函数可能会导致性能下降。
以下过程演示如何使用 SetProps 更新消息的消息类或PR_MESSAGE_CLASS_A (PidTagMessageClass) 属性。
更新消息的消息类
- 为消息类分配 SPropValue 结构,并根据需要设置其成员。
SPropValue spvMsgClass;
spvMsgClass.ulPropTag = PR_MESSAGE_CLASS_A;
spvMsgClass.Value.lpszA = "IPM.NewClass";
- 调用消息的 IMAPIProp::SetProps 方法以设置新消息类。
hRes = lpMessage->SetProps(1, (LPSPropValue) &spvMsgClass, NULL);