Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Add-Ins / November 2005

Tip: Looking for answers? Try searching our database.

Accessing MailItem object in Outbox prevents it being sent

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris_Orange - 23 Nov 2005 09:43 GMT
I have a C++ COM add-in that changes a toolbar custom button state
depending on the item selected.  All works fine except for items in
the Outbox waiting to be sent.  The sequence is:

1. Configure Outlook to not automatically send new emails (so they
stay in the Outbox long enough).
2. Create a few test emails and Click Send.
3. Switch to the Outbox folder.  Most of the emails appear in
bold-italic with the Sent date/time field populated, as normal.
4. When the selection is changed to one of the emails the Explorer
SelectionChange event is fired.
5. The current selection is obtained via the Selection object exposed
by the Explorer using the Selection.Item method.
6. QueryInterface to transform the returned IDispatch interface to a
useable MailItem object.

(After the last step the MailItem properties would then be examined
(Subject, etc.) and used to determine the custom button state).

The last step causes the message to be marked as not ready for
sending:  It is no longer in italic, the Sent date/time shows 'None'
but it is still bold (not read).  It is similar to if it had been
opened manually (when it shows 'this message has not been sent')
except it still shows as unread.  Pressing Send/Receive leaves the
emails in the Outbox.

Doing everything except the QueryInterface in the last step does not
cause the problem.

Q: Is this the expected behaviour?

What I'm looking for is a way to examine the contents of a message in
the Outbox without stopping it from being sent.

I'm running Outlook 2003 on XP.

Many thanks in advance,
Chris
Ken Slovak - [MVP - Outlook] - 23 Nov 2005 15:11 GMT
Expected behavior. If you do that with items that have been sent you're
causing problems. I'd probably intercept Application.Item_Send and get the
items before they hit the Outbox.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

>I have a C++ COM add-in that changes a toolbar custom button state
> depending on the item selected.  All works fine except for items in
[quoted text clipped - 34 lines]
> Many thanks in advance,
> Chris
Chris_Orange - 23 Nov 2005 20:01 GMT
Ken,

Thanks for the reply, that's what I thought but didn't want to hear!
I already intercept the Send event so I'll do as you suggest and also
avoid touching anything in the Outbox.

>Expected behavior. If you do that with items that have been sent you're
>causing problems. I'd probably intercept Application.Item_Send and get the
>items before they hit the Outbox.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.