![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
My is ATL/VC2005. OnNewEmail to dispatch the event.
While OnNewEmail function were invoked, I tried the two methods: 1. "); 2. Get IMessage interface, then call SetProps() function with Tag PR_DISPLAY_TO_A, return value's S_OK. But when i open the message, nothing were changed. What should i do then? |
Ads |
#2
|
|||
|
|||
![]()
And i tried the IMessage::ModifyRecipients(XXX_ADD), it still couldn't work.
And i modified the message header's "to:" field, it seems that no effect to the message itself at all. Could someone help? ryotyankou wrote: My is ATL/VC2005. OnNewEmail to dispatch the event. While OnNewEmail function were invoked, I tried the two methods: 1. "); 2. Get IMessage interface, then call SetProps() function with Tag PR_DISPLAY_TO_A, return value's S_OK. But when i open the message, nothing were changed. What should i do then? -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...ddins/200902/1 |
#3
|
|||
|
|||
![]()
PR_DISPLAY_TO is not settable.
NewMail event (unlike NewMailEx) does not pass the new message as a parameter. How do you retrieve the new message? Do you save the message? -- Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool - "ryotyankou" u48591@uwe wrote in message news:910cacbf18233@uwe... My is ATL/VC2005. OnNewEmail to dispatch the event. While OnNewEmail function were invoked, I tried the two methods: 1. "); 2. Get IMessage interface, then call SetProps() function with Tag PR_DISPLAY_TO_A, return value's S_OK. But when i open the message, nothing were changed. What should i do then? |
#4
|
|||
|
|||
![]()
Not NewMailEx(BSTR xxx), what i processed is Outlook::ItemsEvents OnItemAdd
(LPDISPATCH). With the income MailItem, How to add some other recipients to it? I tried the following code, but couldn't work: IUnknownPtr pUnkSession = MailItem-GetSession()-GetMAPIOBJECT(); if(pUnkSession == NULL) return E_FAIL; IUnknownPtr pUnkMsg = MailItem-GetMAPIOBJECT(); if(pUnkMsg == NULL) return E_FAIL; IMAPISession * pSession; if(FAILED(pUnkSession-QueryInterface(IID_IMAPISession, (void**)&pSession))) { return E_FAIL; } IMessage *pMessage = NULL; if(FAILED(pUnkMsg-QueryInterface(IID_IMessage, (void**)&pMessage))) { pSession-Release(); return E_FAIL; } //test only int nBufSize = CbNewADRLIST(1); LPADRLIST pAddressList=NULL; MAPIAllocateBuffer(nBufSize,(LPVOID FAR*)&pAddressList); memset(pAddressList,0,nBufSize); const int nProperties=2; pAddressList-cEntries=1; pAddressList-aEntries[0].ulReserved1=0; pAddressList-aEntries[0].cValues=nProperties; MAPIAllocateBuffer(sizeof(SPropValue)*nProperties, (LPVOID FAR*)&pAddressList- aEntries[0].rgPropVals); memset(pAddressList-aEntries[0].rgPropVals, 0, sizeof(SPropValue) *nProperties); pAddressList-aEntries[0].rgPropVals[0].ulPropTag=PR_RECIPIENT_TYPE; pAddressList-aEntries[0].rgPropVals[0].Value.ul=MAPI_TO; CString "); pAddressList-aEntries[0].rgPropVals[1].ulPropTag=PR_DISPLAY_NAME; pAddressList-aEntries[0].rgPropVals[1].Value.lpszA=(LPSTR)temp.GetString(); // IAddrBook * pAddrBook = NULL; // if(FAILED(pSession-OpenAddressBook(0, NULL, AB_NO_DIALOG, &pAddrBook))) // { // pSession-Release(); // pMessage-Release(); // FreePadrlist(pAddressList); // return E_FAIL; // } // if(FAILED(pAddrBook-ResolveName(0, cm_nMAPICode, NULL, pAddressList))) // { // pSession-Release(); // pMessage-Release(); // FreePadrlist(pAddressList); // pAddrBook-Release(); // return E_FAIL; // } if(FAILED(pMessage-ModifyRecipients(MODRECIP_ADD, pAddressList))) { pSession-Release(); pMessage-Release(); FreePadrlist(pAddressList); // pAddrBook-Release(); return E_FAIL; } FreePadrlist(pAddressList); pMessage-Release(); // pAddrBook-Release(); pSession-Release(); Dmitry Streblechenko wrote: PR_DISPLAY_TO is not settable. NewMail event (unlike NewMailEx) does not pass the new message as a parameter. How do you retrieve the new message? Do you save the message? My is ATL/VC2005. OnNewEmail to dispatch the event. While OnNewEmail function were invoked, I tried the two methods: [quoted text clipped - 3 lines] were changed. What should i do then? -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...ddins/200902/1 |
#5
|
|||
|
|||
![]()
Hi, Dmitry, I checked my code and found that my process is not cogitate(Use
OnItemAdd, not OnNewMailEx), if the MailItem's encrypted, the add-in will do nothing. Can i convert the entryid(OnNewEmailEx) to MailItem? How could i get IMessage from entryid? Thanks a lot. Dmitry Streblechenko wrote: PR_DISPLAY_TO is not settable. NewMail event (unlike NewMailEx) does not pass the new message as a parameter. How do you retrieve the new message? Do you save the message? My is ATL/VC2005. OnNewEmail to dispatch the event. While OnNewEmail function were invoked, I tried the two methods: [quoted text clipped - 3 lines] were changed. What should i do then? -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...ddins/200902/1 |
#6
|
|||
|
|||
![]()
void __stdcall CPlug1::OnNewMailEx(BSTR EntryId)
{ Outlook::_NameSpacePtr m_NameSpacePtr = m_spApp-ActiveExplorer()- GetSession(); if(m_NameSpacePtr == NULL) { return; } Outlook::_MailItemPtr MailItem = m_NameSpacePtr-GetItemFromID(_bstr_t (EntryId)); //do other things } The code can work with most of the case but encrypted MailItem, again, What should i do then? PR_DISPLAY_TO is not settable. NewMail event (unlike NewMailEx) does not pass the new message as a [quoted text clipped - 6 lines] were changed. What should i do then? -- Message posted via http://www.officekb.com |
#7
|
|||
|
|||
![]()
You never save the message
-- Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool - "ryotyankou via OfficeKB.com" u48591@uwe wrote in message news:9121d684e7a85@uwe... Not NewMailEx(BSTR xxx), what i processed is Outlook::ItemsEvents OnItemAdd (LPDISPATCH). With the income MailItem, How to add some other recipients to it? I tried the following code, but couldn't work: IUnknownPtr pUnkSession = MailItem-GetSession()-GetMAPIOBJECT(); if(pUnkSession == NULL) return E_FAIL; IUnknownPtr pUnkMsg = MailItem-GetMAPIOBJECT(); if(pUnkMsg == NULL) return E_FAIL; IMAPISession * pSession; if(FAILED(pUnkSession-QueryInterface(IID_IMAPISession, (void**)&pSession))) { return E_FAIL; } IMessage *pMessage = NULL; if(FAILED(pUnkMsg-QueryInterface(IID_IMessage, (void**)&pMessage))) { pSession-Release(); return E_FAIL; } //test only int nBufSize = CbNewADRLIST(1); LPADRLIST pAddressList=NULL; MAPIAllocateBuffer(nBufSize,(LPVOID FAR*)&pAddressList); memset(pAddressList,0,nBufSize); const int nProperties=2; pAddressList-cEntries=1; pAddressList-aEntries[0].ulReserved1=0; pAddressList-aEntries[0].cValues=nProperties; MAPIAllocateBuffer(sizeof(SPropValue)*nProperties, (LPVOID FAR*)&pAddressList- aEntries[0].rgPropVals); memset(pAddressList-aEntries[0].rgPropVals, 0, sizeof(SPropValue) *nProperties); pAddressList-aEntries[0].rgPropVals[0].ulPropTag=PR_RECIPIENT_TYPE; pAddressList-aEntries[0].rgPropVals[0].Value.ul=MAPI_TO; CString "); pAddressList-aEntries[0].rgPropVals[1].ulPropTag=PR_DISPLAY_NAME; pAddressList-aEntries[0].rgPropVals[1].Value.lpszA=(LPSTR)temp.GetString(); // IAddrBook * pAddrBook = NULL; // if(FAILED(pSession-OpenAddressBook(0, NULL, AB_NO_DIALOG, &pAddrBook))) // { // pSession-Release(); // pMessage-Release(); // FreePadrlist(pAddressList); // return E_FAIL; // } // if(FAILED(pAddrBook-ResolveName(0, cm_nMAPICode, NULL, pAddressList))) // { // pSession-Release(); // pMessage-Release(); // FreePadrlist(pAddressList); // pAddrBook-Release(); // return E_FAIL; // } if(FAILED(pMessage-ModifyRecipients(MODRECIP_ADD, pAddressList))) { pSession-Release(); pMessage-Release(); FreePadrlist(pAddressList); // pAddrBook-Release(); return E_FAIL; } FreePadrlist(pAddressList); pMessage-Release(); // pAddrBook-Release(); pSession-Release(); Dmitry Streblechenko wrote: PR_DISPLAY_TO is not settable. NewMail event (unlike NewMailEx) does not pass the new message as a parameter. How do you retrieve the new message? Do you save the message? My is ATL/VC2005. OnNewEmail to dispatch the event. While OnNewEmail function were invoked, I tried the two methods: [quoted text clipped - 3 lines] were changed. What should i do then? -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...ddins/200902/1 |
#8
|
|||
|
|||
![]()
So what happens when you process an encrypted message?
-- Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool - "ryotyankou via OfficeKB.com" u48591@uwe wrote in message news:91266404399eb@uwe... void __stdcall CPlug1::OnNewMailEx(BSTR EntryId) { Outlook::_NameSpacePtr m_NameSpacePtr = m_spApp-ActiveExplorer()- GetSession(); if(m_NameSpacePtr == NULL) { return; } Outlook::_MailItemPtr MailItem = m_NameSpacePtr-GetItemFromID(_bstr_t (EntryId)); //do other things } The code can work with most of the case but encrypted MailItem, again, What should i do then? PR_DISPLAY_TO is not settable. NewMail event (unlike NewMailEx) does not pass the new message as a [quoted text clipped - 6 lines] were changed. What should i do then? -- Message posted via http://www.officekb.com |
#9
|
|||
|
|||
![]()
Outlook::_MailItemPtr MailItem = m_NameSpacePtr-GetItemFromID(_bstr_t
(EntryId)); If the message's encrypted, the MailItem is NULL, otherwise, it is ok. Dmitry Streblechenko wrote: So what happens when you process an encrypted message? void __stdcall CPlug1::OnNewMailEx(BSTR EntryId) { [quoted text clipped - 17 lines] were changed. What should i do then? -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...ddins/200902/1 |
#10
|
|||
|
|||
![]()
Are you sure you specify the right entry id?
Do you get an error? I don't think GetItemFromID can ever return null rather than raise an exception. -- Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool - "ryotyankou via OfficeKB.com" u48591@uwe wrote in message news:912e584d7246d@uwe... Outlook::_MailItemPtr MailItem = m_NameSpacePtr-GetItemFromID(_bstr_t (EntryId)); If the message's encrypted, the MailItem is NULL, otherwise, it is ok. Dmitry Streblechenko wrote: So what happens when you process an encrypted message? void __stdcall CPlug1::OnNewMailEx(BSTR EntryId) { [quoted text clipped - 17 lines] were changed. What should i do then? -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...ddins/200902/1 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Can't change text size in received mail | Robert | Outlook Express | 10 | October 23rd 07 01:38 PM |
prevent e-mail message recipients automatically forward a message | IH | Outlook - Using Forms | 3 | November 1st 06 09:00 PM |
How do i change the sent time to received time in outlook message? | Freedom | Outlook - General Queries | 1 | August 1st 06 02:42 PM |
I don't want the recipients to reply my message | Chi | Outlook - General Queries | 1 | March 29th 06 04:40 PM |
Custom meeting form - action on change of recipients | jondxs | Outlook - Using Forms | 2 | March 14th 06 02:24 PM |