The ITnef::FinishComponent method processes individual components from a message one at a time into a TNEF stream.
See ITnef : IUnknown.
HRESULT FinishComponent(
ULONG ulFlags,
ULONG ulComponentID,
LPSPropTagArray lpCustomPropList,
LPSPropValue lpCustomProps,
LPSPropTagArray lpPropList,
LPSTnefProblemArray FAR * lppProblems
);
Transport providers, message store providers, and gateways call the ITnef::FinishComponent method to perform TNEF processing for one component, either a message or an attachment, as indicated by the flag set in the ulFlags parameter.
For component processing to be enabled, the calling provider or gateway must have passed the TNEF_COMPONENT_ENCODING flag in ulFlags for the OpenTnefStream function or OpenTnefStreamEx function that opened the object to receive encoding.
Passing values in lpCustomPropList and lpCustomProps performs component encoding equivalent to that done by the ITnef::SetProps method. Passing a value in the lpPropList parameter performs component encoding equivalent to that done by the ITnef::AddProps method with the TNEF_PROP_INCLUDE flag set in ulFlags. Passing such values enables you to perform encodings with a single call rather than multiple calls.
The TNEF implementation reports TNEF stream encoding problems without halting the FinishComponent process. The STnefProblemArray structure returned in lppProblems indicates which TNEF attributes or MAPI properties, if any, could not be processed. The value returned in the scode member of the STnefProblemArray structure indicates the specific problem. The provider or gateway can work on the assumption that all properties or attributes for which FinishComponent does not return a problem report were processed successfully.
If a provider or gateway does not work with problem arrays, it can pass NULL in lppProblems; in this case, no problem array is returned.
The value returned in lppProblems is only valid if the call returns S_OK. When S_OK is returned, the provider or gateway should check the values returned in the STnefProblemArray structure. If an error occurs on the call, then the STnefProblemArray structure is not filled in and the calling provider or gateway should not use or free the structure. If no error occurs on the call, the calling provider or gateway must release the memory for the STnefProblemArray by calling the MAPIFreeBuffer function.
ITnef::AddProps, ITnef::SetProps, MAPIFreeBuffer, OpenTnefStream, OpenTnefStreamEx, SPropTagArray, STnefProblemArray