PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook Program Addins CreateItem change for Outlook 2007? E_NOINTERFACE for returned objects.

Reply

CreateItem change for Outlook 2007? E_NOINTERFACE for returned objects.

 
Thread Tools Rate Thread
Old 02-06-2007, 06:01 PM   #1
msoliver
Guest
 
Posts: n/a
Default CreateItem change for Outlook 2007? E_NOINTERFACE for returned objects.


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::Application));
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.

  Reply With Quote
Old 05-06-2007, 11:05 PM   #2
Dmitry Streblechenko
Guest
 
Posts: n/a
Default Re: CreateItem change for Outlook 2007? E_NOINTERFACE for returned objects.

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" <michaelsoliver@gmail.com> wrote in message
news:1180803666.976078.81890@m36g2000hse.googlegroups.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::Application));
> 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.
>



  Reply With Quote
Old 07-06-2007, 11:32 PM   #3
msoliver
Guest
 
Posts: n/a
Default Re: CreateItem change for Outlook 2007? E_NOINTERFACE for returned objects.

On Jun 5, 6:05 pm, "Dmitry Streblechenko" <dmi...@dimastr.com> 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" <michaelsoli...@gmail.com> wrote in message
>
> news:1180803666.976078.81890@m36g2000hse.googlegroups.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

  Reply With Quote
Old 08-06-2007, 12:29 AM   #4
Dmitry Streblechenko
Guest
 
Posts: n/a
Default Re: CreateItem change for Outlook 2007? E_NOINTERFACE for returned objects.

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" <michaelsoliver@gmail.com> wrote in message
news:1181255579.866244.174920@p77g2000hsh.googlegroups.com...
> On Jun 5, 6:05 pm, "Dmitry Streblechenko" <dmi...@dimastr.com> 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" <michaelsoli...@gmail.com> wrote in message
>>
>> news:1180803666.976078.81890@m36g2000hse.googlegroups.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
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off