The IMAPISupport::DoCopyProps method copies or moves one or more properties of an object to another object.
HRESULT DoCopyProps(
LPCIID lpSrcInterface,
LPVOID lpSrcObj,
LPSPropTagArray lpIncludeProps,
ULONG ulUIParam,
LPMAPIPROGRESS lpProgress,
LPCIID lpDestInterface,
LPVOID lpDestObj,
ULONG ulFlags,
LPSPropProblemArray FAR * lppProblems
);
[in] Pointer to an implementation of a progress indicator. If NULL is passed in the lpProgress parameter, the progress indicator is displayed using the MAPI implementation. The lpProgress parameter is ignored unless the MAPI_DIALOG flag is set in the ulFlags parameter.
DoCopyProps should perform a move operation rather than a copy operation. When this flag is not set, DoCopyProps performs a copy operation.
[in, out] On input, can be NULL, indicating no need for error information, or a pointer to a pointer to an SPropProblemArray structure. If lppProblems is a valid pointer on input, DoCopyProps returns detailed information about errors in copying one or more properties.
The interface identified by the lpSrcInterface parameter is not supported by the source object or the interface identified by the lpDestInterface parameter is not supported by the destination object.
An attempt was made to access an object for which the caller has insufficient permissions. This error is returned if the destination object is the same as the source object.
The following values can be returned in the SPropProblemArray structure, but not as return values for DoCopyProps. These errors apply to a single property:
The property cannot be modified by the caller because it is a read-only property, computed by the owner of the destination object. This error is not severe; the caller should allow the copy operation to continue.
The IMAPISupport::DoCopyProps method is implemented for message store provider support objects. Message store providers can call DoCopyProps to implement IMAPIProp::CopyProps for their folders and messages. IMAPISupport::DoCopyProps copies or moves the properties identified in the property tag array pointed to by lpIncludeProps that are present in the object pointed to by lpSrcObj.
When copying properties between like objects, such as between two messages, the lpSrcInterface and lpDestInterface parameters must contain the same interface identifier and the lpSrcObj and lpDestObj parameters must point to objects of the same type. If lpDestInterface is set to NULL, then DoCopyProps returns MAPI_E_INVALID_PARAMETER. If you set lpDestInterface to an acceptable interface identifier, but set lpDestObj to an invalid pointer, the results are unpredictable. Most likely your provider will fail.
Set the MAPI_NOREPLACE flag if you do not want any of the properties in the destination object to be overwritten. Properties in the destination object that exist in the source object and are not overwritten are not deleted or modified.
To copy a message's recipient list, include the PR_MESSAGE_RECIPIENTS property in the property tag array pointed to by lpIncludeProps. To copy the message's attachments, include the PR_MESSAGE_ATTACHMENTS property.
To copy a folder or address book container's hierarchy or contents table, include PR_CONTAINER_HIERARCHY or PR_CONTAINER_CONTENTS in the property tag array. To include a folder's associated contents table, include the PR_FOLDER_ASSOCIATED_CONTENTS property in the array.
If subfolders are copied or moved, their contents are copied or moved in their entirety, regardless of the use of properties indicated by the SPropTagArray structure.
DoCopyProps reports global errors — errors that occur with the operation as a whole — and individual errors — errors that occur with one or more of the properties. These individual errors are placed in an SPropProblemArray structure. You can suppress error reporting at the property level by passing NULL for the property problem array structure parameter rather than a valid pointer.
If you want to receive information about errors, pass a valid SPropProblemArray structure pointer in the lppProblems parameter. When DoCopyProps returns S_OK, check for possible errors with individual properties in the structure. When DoCopyProps returns an error, no information is returned in the SPropProblemArray structure. Instead, call IMAPISupport::GetLastError to retrieve detailed error information.
If DoCopyProps returns S_OK, free the returned SPropProblemArray structure by calling the MAPIFreeBuffer function.
IMAPISupport::CopyMessages, IMAPISupport::DoCopyProps, IMAPISupport::DoCopyTo, SPropProblemArray, SPropTagArray