OpenTnefStreamEx
The OpenTnefStreamEx
function creates a TNEF object that can be used to encode or decode a message
object into a TNEF data stream for use by transports or gateways and message
stores. This is the entry-point for TNEF access.
Quick Info
Header
file: |
TNEF.H |
Implemented
by: |
MAPI |
Called by: |
Transport
providers |
HRESULT OpenTnefStreamEx(
LPVOID lpvSupport, |
|
LPSTREAM lpStreamName, |
|
LPTSTR lpszStreamName, |
|
ULONG ulFlags, |
|
LPMESSAGE lpMessage, |
|
WORD wKeyVal, |
|
LPADRBOOK lpAdressBook, |
|
LPITNEF FAR * lppTNEF |
|
); |
|
Parameters
lpvSupport
Passes a
support object or passes in NULL. If NULL, the lpadrbook parameter
should be non-null.
lpStreamName
[in] Pointer
to a storage stream object, such as an OLE IStream interface, providing
a source or destination for a TNEF stream message.
lpszStreamName
[in] Pointer
to the name of the data stream that the TNEF object uses. If the caller has set
the TNEF_ENCODE flag (ulFlags parameter) in its call to OpenTnefStream,
the lpszName parameter must specify a non-null pointer to a non-null
string consisting of any characters considered valid for naming a file. MAPI
does not allow string names including the characters [ , ] , or : , even if the
file system permits their use. The size of the string passed for the lpszName
parameter must not exceed the value of MAX_PATH, the maximum length of a string
containing a path name.
ulFlags
[in] Bitmask
of flags used to indicate the mode of the function. The following flags can be
set:
TNEF_BEST_DATA
All possible
properties are mapped into their down-level attributes, but when there is a
possible data loss due to the conversion to a down-level attribute, the
property is also encoded in the encapsulations. NOTE: this will cause the
duplication of information in the TNEF stream. TNEF_BEST_DATA is the default if
no other modes are specified.
TNEF_COMPATIBILITY
Ensures
backwards compatibility with the MAIL 3.0 client. TNEF streams encoded with
this flag will map all possible properties into their corresponding down-level
attribute. This mode also causes the defaulting of some properties that are
required by down-level clients.
TNEF_DECODE
The TNEF
object on the indicated stream is opened with read-only access. The transport
provider must set this flag if it wants the function to initialize the object
for subsequent decoding.
TNEF_ENCODE
The TNEF
object on the indicated stream is opened for read/write access. The transport
provider must set this flag if it wants the function to initialize the object
for subsequent encoding.
TNEF_PURE
Encodes all
properties into the MAPI encapsulation blocks. Therefore, a "pure"
TNEF file will consist of, at most, the attributes attMAPIProps, attAttachment,
attRenddata, and attRecipTable. This mode is ideal for use when no backwards
compatibility is required.
lpMessage
[in] Pointer
to a message object as a destination for a decoded message with attachments or
a source for an encoded message with attachments. Any properties of a
destination message can be overwritten by the properties of an encoded message.
wKeyVal
[in] A search
key that the TNEF object uses to match attachments to the text tags inserted in
the message text. This value should be relatively unique across messages.
lpAdressBook
[in]
Pointer to an address book object used to get addressing information for entry
identifiers.
lppTNEF
[out] Pointer
to the new TNEF object.
Return Values
S_OK
The call
succeeded and has returned the expected value or values.
Remarks
The OpenTnefStreamEx
function is the recommended replacement for OpenTnefStream
A TNEF object
created by the OpenTnefStreamEx function later calls the OLE method IUnknown::AddRef
to add references for the support object, the stream object, and the message
object. The transport provider can release the references for all three objects
with a single call to the OLE method IUnknown::Release on the TNEF
object.
OpenTnefStreamEx allocates and initializes a TNEF object for the
provider to use in encoding a MAPI message into a TNEF stream message.
Alternatively, this function can set up the object for the provider to use in
subsequent calls to ITnef::ExtractProps
A
32-bit Windows program should call OpenTnefStreamEx strictly as defined
in the syntax, using the name provided. However, a 16-bit Windows program can
set its own name for this function using the OPENTNEFSTREAM function
prototype. The prototype has exactly the same syntax as the formal function,
except that it designates a return value of HRESULT instead of STDMETHODIMP.
The
base value for the wKeyVal parameter must not be zero and should not be
the same for every call to OpenTnefStreamEx. Instead, use random numbers
based on the system time from the run-time library s random number generator.
See Also
IMAPISupport
: IUnknown, IXPProvider::TransportLogon