Share via


IMAPIProp::OpenProperty (Compact 7)

3/12/2014

The OpenProperty method returns a pointer to an interface to be used to access a property.

Note

The OpenProperty method is implemented only for the IAttach, IMessage, IMAPIFolder, and IMsgStore interface objects.

Syntax

HRESULT OpenProperty (
  ULONG ulPropTag,
  LPCIID lpiid,
  ULONG ulInterfaceOptions,
  ULONG ulFlags,
  LPUNKNOWN FAR * lppUnk
);

Parameters

  • ulPropTag
    [in] Property tag for the property to be accessed; cannot be zero. Both the identifier and the type must be included in the property tag.
  • lpiid
    [in] Ignored.
  • ulInterfaceOptions
    [in] Ignored.
  • ulFlags
    [in] Bitmask of flags that controls access to the property. The following flag can be set:

    MAPI_MODIFY

    Requests read/write access to the property. The default access is read-only.

  • lppUnk
    [out] Reference to the requested interface object to be used for property access.

Return Value

The OpenProperty method returns the following standard HRESULT values.

  • S_OK
    The operation completed successfully.
  • E_FAIL
    The operation failed due to an unspecified error.
  • E_INVALIDARG
    The operation failed because one (or more) of the arguments is not valid.
  • E_OUTOFMEMORY
    The operation failed because it needs more memory resources.
  • E_UNEXPECTED
    The operation failed due to an unexpected failure.
  • MAPI_E_INTERFACE_NOT_SUPPORTED
    The requested interface is not supported for this property.
  • MAPI_E_NO_ACCESS
    The caller has insufficient permissions to access the property.
  • MAPI_E_NO_SUPPORT
    The object cannot provide access to this property through the requested interface.
  • MAPI_E_NOT_FOUND
    The requested property does not exist.
  • MAPI_E_INVALID_PARAMETER
    The property type in the tag is set to PT_UNSPECIFIED.

Remarks

OpenProperty is an alternate to IMAPIProp::GetProps and IMAPIProp::SetProps. When either GetProps or SetProps fails because the property is too large or too complex, call OpenProperty. OpenProperty is commonly used to access properties of type PT_OBJECT.

If OpenProperty is called from an IAttach interface object, the property represented by ulPropTag can only equal PR_ATTACH_DATA_BIN.

In Messaging, lppUnk always returns a reference to an IStream interface object. You are responsible for recasting *lppUnk to an IStream pointer. You must also use the returned IStream pointer to call its Release method when you have finished with it.

Do not use the IStream pointer that you receive to call either its Seek or SetSize method, unless you use an offset position or size variable. Also, do not rely on the value of the plibNewPositionoutput parameter returned from the Seek call.

If you call OpenProperty to access a property with the IStream interface, use only that interface to make changes to it. Do not attempt to update the property with any of the other IMAPIProp methods such as SetProps or IMAPIProp::DeleteProps.

Do not try to open a property with OpenProperty more than once. The results are undefined because they can vary from provider to provider.

If you need to modify the property to be opened, set the MAPI_MODIFY flag. If you are not sure whether the object supports the property but think it should, set the MAPI_MODIFY flags.

Requirements

Header

mapidefs.h

Library

cemapi.lib

See Also

Reference

IMAPIProp
IMAPIProp::DeleteProps
IMAPIProp::GetProps
IMAPIProp::SetProps