The OpenProperty method returns a pointer to an interface to be used to access a property.
|Windows Mobile Messaging implements this method only for IAttach and IMessage interface objects.|
HRESULT OpenProperty ( ULONG ulPropTag, LPCIID lpiid, ULONG ulInterfaceOptions, ULONG ulFlags, LPUNKNOWN FAR * lppUnk );
[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.
[in] Bitmask of flags that controls access to the property. The following flag can be set:
Requests read/write access to the property. The default access is read-only.
[out] Reference to the requested interface object to be used for property access.
This method returns the standard values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL, as well as the following:
The requested interface is not supported for this property.
The caller has insufficient permissions to access the property.
The object cannot provide access to this property through the requested interface.
The requested property does not exist.
The property type in the tag is set to PT_UNSPECIFIED.
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 Windows Mobile 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 plibNewPosition output 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 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.