![]() |
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
|
|||
|
|||
![]()
Hi, Dmitry, Thank you for your help. This is not a new problem, but unsolved
one. It's written by VC2005/ATL, an outlook plugin. (Outlook::ApplicationEvents_11), 0x0000FAB5, OnNewMailEx void __stdcall CXXX::OnNewMailEx(BSTR EntryId) { //Codes to get m_NameSpacePtr; Outlook::_MailItemPtr NewMailItem = m_NameSpacePtr-GetItemFromID(_bstr_t (EntryId)); } Can this code get all current entryid? If the income e-mail is not encrypted, the GetItemFromID can get _MailItemPtr normally. Or it will return NULL. As you mentioned, "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. " But here the EntryId is pass in by Outlook, and never be changed, What should i do with the pass-in paramater EntryId, is there a way to make it 'current' and then pass to GetItemFromID to get the _MailItemPtr even it is encrypted Mail item?? -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...ddins/200902/1 |
Ads |
#2
|
|||
|
|||
![]()
I am not sure what you mean by "current entry id".
What are you trying to solve? Null being retruned from GetItemFromID? Did you try to declare NewMailItem as a generic IDispatch in case you have something other than MailItem? -- Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool - "ryotyankou via OfficeKB.com" u48591@uwe wrote in message news:9243b14874627@uwe... Hi, Dmitry, Thank you for your help. This is not a new problem, but unsolved one. It's written by VC2005/ATL, an outlook plugin. (Outlook::ApplicationEvents_11), 0x0000FAB5, OnNewMailEx void __stdcall CXXX::OnNewMailEx(BSTR EntryId) { //Codes to get m_NameSpacePtr; Outlook::_MailItemPtr NewMailItem = m_NameSpacePtr-GetItemFromID(_bstr_t (EntryId)); } Can this code get all current entryid? If the income e-mail is not encrypted, the GetItemFromID can get _MailItemPtr normally. Or it will return NULL. As you mentioned, "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. " But here the EntryId is pass in by Outlook, and never be changed, What should i do with the pass-in paramater EntryId, is there a way to make it 'current' and then pass to GetItemFromID to get the _MailItemPtr even it is encrypted Mail item?? -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...ddins/200902/1 |
#3
|
|||
|
|||
![]()
I'm sorry, i typed wrong word, it is not "current" but "correct". My purpose
is just to retrieve the MailItem from the pass-in paramater (BSTR entryid). But the GetItemFormID return NULL if e-mail's encrypted. Yes, i tried to get a generic IDispatch from GetItemFromID, it's OK, but i have no idea what could i do with the gotten IDispatch pointer. Again, my purpose is to get encrypted e-mail's MailItem so that i can operate the e- mail easily. Any ideas? TIA. Dmitry Streblechenko wrote: I am not sure what you mean by "current entry id". What are you trying to solve? Null being retruned from GetItemFromID? Did you try to declare NewMailItem as a generic IDispatch in case you have something other than MailItem? Hi, Dmitry, Thank you for your help. This is not a new problem, but unsolved [quoted text clipped - 18 lines] there a way to make it 'current' and then pass to GetItemFromID to get the _MailItemPtr even it is encrypted Mail item?? -- Message posted via http://www.officekb.com |
#4
|
|||
|
|||
![]()
Can you use late binding (IDispatch::GetIDsOfNames/Invoke) to retrieve the
Class property? What do you see if you run the following script from Outlook Spy (click "Script Editor" button on the OutlookSpy toolbar, paste the script, click Run) BrowseObject(Application.ActiveExplorer.Selection( 1)) -- Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool - "ryotyankou via OfficeKB.com" u48591@uwe wrote in message news:924f9d529567c@uwe... I'm sorry, i typed wrong word, it is not "current" but "correct". My purpose is just to retrieve the MailItem from the pass-in paramater (BSTR entryid). But the GetItemFormID return NULL if e-mail's encrypted. Yes, i tried to get a generic IDispatch from GetItemFromID, it's OK, but i have no idea what could i do with the gotten IDispatch pointer. Again, my purpose is to get encrypted e-mail's MailItem so that i can operate the e- mail easily. Any ideas? TIA. Dmitry Streblechenko wrote: I am not sure what you mean by "current entry id". What are you trying to solve? Null being retruned from GetItemFromID? Did you try to declare NewMailItem as a generic IDispatch in case you have something other than MailItem? Hi, Dmitry, Thank you for your help. This is not a new problem, but unsolved [quoted text clipped - 18 lines] there a way to make it 'current' and then pass to GetItemFromID to get the _MailItemPtr even it is encrypted Mail item?? -- Message posted via http://www.officekb.com |
#5
|
|||
|
|||
![]()
The result of run script is: The MailItem property page is shown. I have no
idea about the first paramater of GetIDsOfNames, i give it "_MailItem" which i saw via OutlookSpy as its value, but return E_NOINTERFACE. I had another try, if we can get the dispatch pointer, why not to use it to QI the MailItem? This is the code i tried, but failed with return value "E_NOINTERFACE", what's the wrong with my code? Outlook::_NameSpacePtr NameSpacePtr = m_spApp-ActiveExplorer()-GetSession() ; if(NameSpacePtr == NULL) { return; } Outlook::MAPIFolderPtr inboxFolderPtr = NameSpacePtr-GetDefaultFolder (Outlook: ![]() if(inboxFolderPtr == NULL) { return; } IDispatch *lpDisp = NameSpacePtr-GetItemFromID(_bstr_t(EntryId), _variant_t (inboxFolderPtr-StoreID)); if(lpDisp == NULL) { return; } HRESULT hr = S_OK; Outlook::_MailItemPtr spMailItem; hr = lpDisp-QueryInterface(__uuidof(Outlook::_MailItem),(void **)&spMailItem) ; if(SUCCEEDED(hr))//always return E_NOINTERFACE { //do my work here } Dmitry Streblechenko wrote: Can you use late binding (IDispatch::GetIDsOfNames/Invoke) to retrieve the Class property? What do you see if you run the following script from Outlook Spy (click "Script Editor" button on the OutlookSpy toolbar, paste the script, click Run) BrowseObject(Application.ActiveExplorer.Selection (1)) I'm sorry, i typed wrong word, it is not "current" but "correct". My purpose [quoted text clipped - 17 lines] the _MailItemPtr even it is encrypted Mail item?? -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...ddins/200903/1 |
#6
|
|||
|
|||
![]()
That means the message is not a MailItem. Could be ReportItem, MeetingItem,
etc. The first parameter in GetIDsOfNames is the name of the property, e.g. "Class". -- Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool - "ryotyankou via OfficeKB.com" u48591@uwe wrote in message news:92786b09727d7@uwe... The result of run script is: The MailItem property page is shown. I have no idea about the first paramater of GetIDsOfNames, i give it "_MailItem" which i saw via OutlookSpy as its value, but return E_NOINTERFACE. I had another try, if we can get the dispatch pointer, why not to use it to QI the MailItem? This is the code i tried, but failed with return value "E_NOINTERFACE", what's the wrong with my code? Outlook::_NameSpacePtr NameSpacePtr = m_spApp-ActiveExplorer()-GetSession() ; if(NameSpacePtr == NULL) { return; } Outlook::MAPIFolderPtr inboxFolderPtr = NameSpacePtr-GetDefaultFolder (Outlook: ![]() if(inboxFolderPtr == NULL) { return; } IDispatch *lpDisp = NameSpacePtr-GetItemFromID(_bstr_t(EntryId), _variant_t (inboxFolderPtr-StoreID)); if(lpDisp == NULL) { return; } HRESULT hr = S_OK; Outlook::_MailItemPtr spMailItem; hr = lpDisp-QueryInterface(__uuidof(Outlook::_MailItem),(void **)&spMailItem) ; if(SUCCEEDED(hr))//always return E_NOINTERFACE { //do my work here } Dmitry Streblechenko wrote: Can you use late binding (IDispatch::GetIDsOfNames/Invoke) to retrieve the Class property? What do you see if you run the following script from Outlook Spy (click "Script Editor" button on the OutlookSpy toolbar, paste the script, click Run) BrowseObject(Application.ActiveExplorer.Selectio n(1)) I'm sorry, i typed wrong word, it is not "current" but "correct". My purpose [quoted text clipped - 17 lines] the _MailItemPtr even it is encrypted Mail item?? -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...ddins/200903/1 |
#7
|
|||
|
|||
![]()
No, i don't think so, i'm sure it is a MailItem, because it is my test e-mail
(It is the case, my outlook have two accounts, A and B, i Use A send an encrypted e-mail to B, and receive this e-mail, then the plugin will enter OnNewMailEx(BSTR entryId) function.). I got it, i can use GetIDsOfNames to get a class property of this income item, but i can't get MailItem, am i right? Dmitry Streblechenko wrote: That means the message is not a MailItem. Could be ReportItem, MeetingItem, etc. The first parameter in GetIDsOfNames is the name of the property, e.g. "Class". The result of run script is: The MailItem property page is shown. I have no [quoted text clipped - 50 lines] the _MailItemPtr even it is encrypted Mail item?? -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...ddins/200903/1 |
#8
|
|||
|
|||
![]()
The whole point of retrieving the value of the Class property is to make
sure trhat you really have a MailItem object. Try the following script in OutlookSpy: click Application button on the OutlookSpy toolbar, go to the Script tab, paste teh script below. Now whenever a new message arrives, OutlookSpy will open a new IDispatch browser where you shoudl be able to see all the object properties. sub Application_NewMailEx(EntryIDCollection) set Msg = Application.Session.GetItemfromID(EntryIDCollectio n) BrowseObject(Msg) end sub -- Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool - "ryotyankou via OfficeKB.com" u48591@uwe wrote in message news:928e607f8eb42@uwe... No, i don't think so, i'm sure it is a MailItem, because it is my test (It is the case, my outlook have two accounts, A and B, i Use A send an encrypted e-mail to B, and receive this e-mail, then the plugin will enter OnNewMailEx(BSTR entryId) function.). I got it, i can use GetIDsOfNames to get a class property of this income item, but i can't get MailItem, am i right? Dmitry Streblechenko wrote: That means the message is not a MailItem. Could be ReportItem, MeetingItem, etc. The first parameter in GetIDsOfNames is the name of the property, e.g. "Class". The result of run script is: The MailItem property page is shown. I have no [quoted text clipped - 50 lines] the _MailItemPtr even it is encrypted Mail item?? -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...ddins/200903/1 |
#9
|
|||
|
|||
![]()
Thank you for your help so far, i change my way to process the incoming e-
mail, use IMessage interface instead of MailItem. These are the steps: 1.Use OpenEntry open the item to get IMessage interface. 2.Use IMessage interface query IMAPIProp interface, then make operation on the item. It works fine, Thank you again in advance, you are great people. ^_^ Dmitry Streblechenko wrote: The whole point of retrieving the value of the Class property is to make sure trhat you really have a MailItem object. Try the following script in OutlookSpy: click Application button on the OutlookSpy toolbar, go to the Script tab, paste teh script below. Now whenever a new message arrives, OutlookSpy will open a new IDispatch browser where you shoudl be able to see all the object properties. sub Application_NewMailEx(EntryIDCollection) set Msg = Application.Session.GetItemfromID(EntryIDCollectio n) BrowseObject(Msg) end sub No, i don't think so, i'm sure it is a MailItem, because it is my test [quoted text clipped - 17 lines] the _MailItemPtr even it is encrypted Mail item?? -- Message posted via http://www.officekb.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Create Outlook tasks "current view" as a calendar option | Wright | Outlook - Using Forms | 6 | April 5th 07 06:31 PM |
Journal "Start Date" and "Entry Created Date" | joemce | Outlook - Using Contacts | 0 | August 1st 06 07:33 PM |
Outlook Multi-email acct should default "From address" to current | SB | Outlook - Installation | 7 | July 31st 06 05:57 PM |
Explain Journal entry vs. "Notes" section on Contact "Box" | Charles Dice | Outlook - Using Contacts | 1 | July 11th 06 03:50 PM |
open "new appointment" at current time for incidental meeting etc | Bill! | Outlook - Calandaring | 1 | May 16th 06 12:26 PM |