HOWTO: Customizing the Reply To Property for a Message |
Q165350
There may be times when you want to force the reply of a message to a particular person or distribution list. You can accomplish this by using the PR_REPLY_RECIPIENT_NAMES property of the message.
You can set the PR_REPLY_RECIPIENT_NAMES property by using code. It should be noted that the code sample below is not a complete working program and it assumes that you have a handle to a MAPI session.
pspvOut[OBSENTREP].ulPropTag = PR_REPLY_RECIPIENT_NAMES;
pspvOut[OBSENTREP].Value.lpszA = "[SMTP:testing@Microsoft.com]";
LPADRLIST pAdrList = NULL;
if (FAILED(hRes = MAPIAllocateBuffer(CbNewSRowSet(1),
(LPVOID*) &pAdrList)))
goto Quit;
if (FAILED(hRes = MAPIAllocateBuffer(
NUM_RECIP_PROPS * sizeof(SPropValue),
(LPVOID*) &(pAdrList->aEntries[0].rgPropVals) )))
goto Quit;
pAdrList->cEntries = 1;
pAdrList->aEntries[0].cValues = 4;
pAdrList->aEntries[0].rgPropVals[NAME].ulPropTag = PR_DISPLAY_NAME;
pAdrList->aEntries[0].rgPropVals[NAME].Value.lpszA="Test User";
pAdrList->aEntries[0].rgPropVals[ADDR].ulPropTag = PR_ADDRTYPE;
pAdrList->aEntries[0].rgPropVals[ADDR].Value.lpszA = "SMTP";
pAdrList->aEntries[0].rgPropVals[EMAIL].ulPropTag = PR_EMAIL_ADDRESS;
pAdrList->aEntries[0].rgPropVals[EMAIL].Value.lpszA = "";
pAdrList->aEntries[0].rgPropVals[RECIP].ulPropTag =
PR_RECIPIENT_TYPE;
pAdrList->aEntries[0].rgPropVals[RECIP].Value.l = MAPI_TO;
hRes = m_pAddrBook->ResolveName(NULL,MAPI_DIALOG,
"Resolve Names",pAdrList);
if (FAILED(hRes = pMsg ->
SetProps(NUM_OUTBOUND_PROPS,pspvOut,&pPropProblemArray)))
goto Quit;
hRes = pMsg -> ModifyRecipients(0,pAdrList); Microsoft Developer Network, WIN32 SDK
Additional query words:
Keywords : kbprg kbMsg kbMAPI100
Issue type : kbhowto
Technology :
|
Last Reviewed: November 9, 1999 © 2001 Microsoft Corporation. All rights reserved. Terms of Use. |