Platform SDK: MAPI |
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 );
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 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