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 / September 2003

Tip: Looking for answers? Try searching our database.

How to get the MailItem.SentOn property when sending email?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jenny Tam - 19 Sep 2003 18:46 GMT
Hello

I've created a COM add-in for Outlook in VC++.  One of my goals is to
create a 'Log and Send' button in the Inspector (for new mail only)
such that when the user clicks it, the add-in will send the email on
behalf of the user.  At the same time, the add-in will get various
properties of the email and log them to a SQL database.

I have no problem trapping the Application.ItemSend event.  In this
event, I can get most properties I want except for the MailItem.SentOn
property.  During the ItemSend event, MailItem.Sent is false and
MailItem.SentOn is undefined.

So how exactly can I get the correct MailItem.SentOn property?  I
don't think I can rely on monitoring 'Sent Items' because the user
might choose not to save copies of messages in Sent Items folder.  So
should I check Outbox?  What about offline users?

I also want to know whether I can update the corresponding MailItem in
the Sent Items folder.  For example, I'd like to add a UserProperty
'Logged' (olYesNo) to the MailItem.  I don't want to add it during the
ItemSend event because I don't want my recipient to see this
UserProperty.  Is this even possible?

Any help is appreciated!
Jenny
Jenny Tam - 23 Sep 2003 20:09 GMT
Hi there,

I really need help with this.  Can somebody out there help?
I'd like to know if this is even possible!

Thank you very much,
Jenny

> Hello
>
[quoted text clipped - 22 lines]
> Any help is appreciated!
> Jenny
Sue Mosher [MVP] - 23 Sep 2003 20:37 GMT
You would need to get the value of that property *after* the item has been sent, i.e. after it has left the Outbox and moved to the Sent Items folder or whatever folder was designated as its final target. And, yes, you're correct that the user could choose not to save it in Sent Items at all. Another option, therefore, would be to use the current system time in your Application.ItemSend code and hope that the user does not have time to delete the item from the Outbox.

> Hello
>
[quoted text clipped - 22 lines]
> Any help is appreciated!
> Jenny
Jenny Tam - 24 Sep 2003 17:18 GMT
Thanks for the reply!  

So does it mean that it is impossible to get the exact SentOn
property?  I thought about your proposed solution, but I am not sure
if this will work for users who are offline ...

I guess I also know the answer to my other question ... that I cannot
add any user property to a sent item.

Jenny

> You would need to get the value of that property *after* the item has
> been sent, i.e. after it has left the Outbox and moved to the Sent Items
[quoted text clipped - 30 lines]
> > Any help is appreciated!
> > Jenny
Jenny Tam - 25 Sep 2003 18:08 GMT
Someone told me that using the PR_LAST_MODIFICATION_TIME in Extended
MAPI might work when the message is about to be sent.  Can anybody
confirm?

In Outlook, MailItem.SentOn, MailItem.LastModificationTime and
MailItem.CreationTime properties are all undefined in
Application.ItemSend().  When I called MailItem.Save() in ItemSend(),
I did get the last two properties.  Unfortunately, when I checked the
MailItem later in the Sent Items, both CreationTime and
LastModificationTime are slightly different from the ones I got from
ItemSend().  :(

Thanks,
Jenny

> Thanks for the reply!  
>
[quoted text clipped - 41 lines]
> > > Any help is appreciated!
> > > Jenny
 
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.