共用方式為


SetAttribIMsgOnIStg

Applies to: Office 2010 | Outlook 2010 | Visual Studio

Sets or alters attributes of properties on an IMessage object supplied by the OpenIMsgOnIStg function.

Header file:

Imessage.h

Implemented by:

MAPI

Called by:

Client applications and message store providers

HRESULT SetAttribIMsgOnIStg(
  LPVOID lpObject,
  LPSPropTagArray lpPropTags,
  LPSPropAttrArray lpPropAttrs,
  LPSPropProblemArray FAR * lppPropProblems
);

Parameters

  • lpObject
    [in] Pointer to the object for which property attributes are being set.

  • lpPropTags
    [in] Pointer to an SPropTagArray structure containing an array of property tags indicating the properties for which property attributes are being set.

  • lpPropAttrs
    [in] Pointer to an SPropAttrArray structure listing the property attributes to set.

  • lppPropProblems
    [out] Pointer to the returned SPropProblemArray structure containing a set of property problems. This structure identifies problems encountered if SetAttribIMsgOnIStg has been able to set some properties, but not all. If a pointer to NULL is passed in the lppPropProblems parameter, no property problem array is returned even if some properties were not set.

Return Value

  • S_OK
    The call succeeded and has returned the expected value or values.

  • MAPI_W_ERRORS_RETURNED
    The call succeeded overall, but one or more properties could not be accessed and were returned with a property type of PT_ERROR.

Remarks

Property attributes can only be accessed on property objects, that is, objects implementing the IMAPIProp : IUnknown interface. To make MAPI properties available on an OLE structured storage object, OpenIMsgOnIStg builds an IMessage : IMAPIProp object on top of the OLE IStorage object. The property attributes on such objects can be set or altered with SetAttribIMsgOnIStg and retrieved with GetAttribIMsgOnIStg.

Note  GetAttribIMsgOnIStg and SetAttribIMsgOnIStg do not operate on all IMessage objects. They are only valid for IMessage-on-IStorage objects returned by OpenIMsgOnIStg.

In the lpPropAttrs parameter, the number and position of the attributes must match the number and position of the property tags passed in the lpPropTags parameter.

The SetAttribIMsgOnIStg function is used to make message properties read-only when required by the IMessage schema. The sample message store provider uses it for this purpose. For more information, see Messages.