setting recipient name when creating a message via IMAPIFolder::CreateMessage
- From: nvmdwm2008 <noreply@xxxxxxxxxxx>
- Date: Tue, 30 Sep 2008 08:22:01 +0000 (UTC)
This is for PocketPC. I posted in the pocketpc.developer newsgroup and MSDN forum but no reply so I posted it here. Hope to have some hints.
I successfully created a message in Sent Items folder using the following code.
However, I want Pocket Outlook to show the recipient name (instead of the recipient number) when the message is displayed in the list. How can I do that? Is there any flag that tells Pocket Outlook to look up the address book and maps the recipient number to the contact name and display the contact name instead, or must I set the recipient name manually? I mean, what property should I add to the property array when creating the message?
LPMESSAGE pmsg;
hr = currentFolder->CreateMessage(NULL, 0, &pmsg); if (hr!= S_OK) return hr;
//add recipients
SPropValue propRecipient[3]; ZeroMemory(&propRecipient, sizeof(propRecipient)); propRecipient[0].ulPropTag = PR_RECIPIENT_TYPE; propRecipient[0].Value.l = MAPI_TO; propRecipient[1].ulPropTag = PR_ADDRTYPE; propRecipient[1].Value.lpszW = _T("SMS"); propRecipient[2].ulPropTag = PR_EMAIL_ADDRESS; propRecipient[2].Value.lpszW = msgRecipient;
ADRLIST adrlist; adrlist.cEntries = 1; adrlist.aEntries[0].cValues = 3; adrlist.aEntries[0].rgPropVals = (LPSPropValue)(&propRecipient); hr = pmsg->ModifyRecipients(MODRECIP_ADD, &adrlist);
//change other properties
SPropValue props[5]; //add one more element to hold the contact name
ZeroMemory(&props, sizeof(props));
//PR_SUBJECT points to SMS contents
props[0].ulPropTag = PR_SUBJECT; props[0].Value.lpszW = msgSubject;
//type of message. Without this it'll be an email
props[1].ulPropTag = PR_MESSAGE_CLASS;
props[1].Value.lpszW = TEXT("IPM.SMStext");
//mark message as read
props[2].ulPropTag = PR_MESSAGE_FLAGS; props[2].Value.ul = MSGFLAG_READ | MSGFLAG_FROMME | MSGFLAG_UNSENT;
//set delivery time to system time
SYSTEMTIME stNow;
FILETIME ftNow;
GetSystemTime(&stNow);
SystemTimeToFileTime(&stNow, &ftNow)
props[3].ulPropTag = PR_MESSAGE_DELIVERY_TIME;
props[3].Value.ft = ftNow;
//set contact name. What should I assign to ulPropTag
props[4].ulPropTag = ???;
props[4].Value.lpszW = TEXT("Contact Name goes here");
//assign the property to the message
hr = pmsg->SetProps(sizeof(props) / sizeof(props[0]), (LPSPropValue)&props, NULL);
One of the moderators on MSDN forum states that he has tried and did not successfully set the property. Any ideas how I can do it? Thanks.
[Original thread: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3852632&SiteID=1]
.
- Prev by Date: Re: Export as MIMI
- Next by Date: [PocketPC] send MMS using MAPI
- Previous by thread: Export as MIMI
- Next by thread: [PocketPC] send MMS using MAPI
- Index(es):
Relevant Pages
|