A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Tags: , , , , , ,

CreateItem change for Outlook 2007? E_NOINTERFACE for returned objects.





 
 
Thread Tools Display Modes
  #1  
Old June 2nd 07, 07:01 PM posted to microsoft.public.outlook.program_addins
msoliver
external usenet poster
 
Posts: 2
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::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  
Old June 6th 07, 12:05 AM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 1,592
Default 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" 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  
Old June 8th 07, 12:32 AM posted to microsoft.public.outlook.program_addins
msoliver
external usenet poster
 
Posts: 2
Default CreateItem change for Outlook 2007? E_NOINTERFACE for returned objects.

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  
Old June 8th 07, 01:29 AM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 1,592
Default 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" 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

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
Forum Jump

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


All times are GMT +1. The time now is 01:54 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2008 Outlook Banter, part of the NewsgroupBanter project.
The comments are property of their posters.
Personal Car Finance - Electricity Suppliers - MPAA - Mortgages - Loans