![]() |
| 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. |
|
|||||||
| Tags: 2007, change, createitem, e_nointerface, objects, outlook, returned |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
I'm writing a simple C++/ATL program that is interacting w/ the
Outlook object model. There seems to be some odd change to Application.CreateItem for Outlook 2007. Here are my simple lines of code: Outlook::_ApplicationPtr spApplication; Outlook::_MailItemPtr spMailItem; HRESULT hr = spApplication.CreateInstance(__uuidof(Outlook::App lication)); if (FAILED(hr)) return; spMailItem = spApplication-CreateItem(Outlook: lMailItem);spMailItem is NULL after this code executes. Stepping into CreateItem, I see that it is returning a IDispatch*, but then when the QueryInterface occurs for the _MailItem* interface, the COM error code is: E_NOINTERFACE. This seems to be the case for all of the different types of Outlook items, not just mail items. What changed? What object is being returned by CreateItem? I've looked all over the net and MSDN and found no info - am stumped. |
| Ads |
|
#2
|
|||
|
|||
|
I don't think anything changed in that area. Does it make any difference if
Outlook is already running when your code is executed? Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "msoliver" wrote in message ups.com... I'm writing a simple C++/ATL program that is interacting w/ the Outlook object model. There seems to be some odd change to Application.CreateItem for Outlook 2007. Here are my simple lines of code: Outlook::_ApplicationPtr spApplication; Outlook::_MailItemPtr spMailItem; HRESULT hr = spApplication.CreateInstance(__uuidof(Outlook::App lication)); if (FAILED(hr)) return; spMailItem = spApplication-CreateItem(Outlook: lMailItem);spMailItem is NULL after this code executes. Stepping into CreateItem, I see that it is returning a IDispatch*, but then when the QueryInterface occurs for the _MailItem* interface, the COM error code is: E_NOINTERFACE. This seems to be the case for all of the different types of Outlook items, not just mail items. What changed? What object is being returned by CreateItem? I've looked all over the net and MSDN and found no info - am stumped. |
|
#3
|
|||
|
|||
|
On Jun 5, 6:05 pm, "Dmitry Streblechenko" wrote:
I don't think anything changed in that area. Does it make any difference if Outlook is already running when your code is executed? Dmitry Streblechenko (MVP)http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "msoliver" wrote in message ups.com... No diffference. Same result if Outlook is running. CreateItem is returning an IDispatch object, just can't seem to QueryInterface on it to get the right item... Any ideas? Thx, - Mike |
|
#4
|
|||
|
|||
|
Can you check that the GUID is right?? Or hardcode QI to use
{00063034-0000-0000-C000-000000000046}? Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "msoliver" wrote in message oups.com... On Jun 5, 6:05 pm, "Dmitry Streblechenko" wrote: I don't think anything changed in that area. Does it make any difference if Outlook is already running when your code is executed? Dmitry Streblechenko (MVP)http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "msoliver" wrote in message ups.com... No diffference. Same result if Outlook is running. CreateItem is returning an IDispatch object, just can't seem to QueryInterface on it to get the right item... Any ideas? Thx, - Mike |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| CreateItem - Operation Failed | JKro | Outlook and VBA | 7 | December 21st 06 05:49 PM |
| Outlook 2007 Links.Item - what is returned? | David Hyde | Outlook and VBA | 1 | October 24th 06 02:26 PM |
| CreateItem message format | Peter Ramsebner | Outlook and VBA | 2 | October 4th 06 03:53 PM |
| QI to IOleWindow returns E_NOINTERFACE | Vinayakc | Add-ins for Outlook | 8 | April 28th 06 08:51 AM |
| getting E_NOINTERFACE trying to create outlook.application in vc++ (2005) on xp | jay.oleary@gmail.com | Add-ins for Outlook | 2 | February 17th 06 06:18 PM |