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

Losing handle to MailItem when send



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 1st 06, 04:47 PM posted to microsoft.public.outlook.program_addins
donald
external usenet poster
 
Posts: 25
Default Losing handle to MailItem when send

If you access Outlook through COM-automation and create a new MailItem,
you lose access to it when it is send.

"The subject has been moved or deleted" or some such error message you
get, if you try to access any of the mails properties after it has been
send.

I know i need to keep track of the MailItem where it is using
MAPIFolder.Items.ItemAdd event on the "Sent Items" folder and add a
unique custom property to the message and then search for that message
in the "Sent Items" folder.

I got the ItemAdd and it find it but i need to check it is the right
message so how can i add a custom property to all the MailItem in
outlook?

Thanks

Donald

  #2  
Old February 1st 06, 04:52 PM posted to microsoft.public.outlook.program_addins
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Losing handle to MailItem when send

You should be able to use the Application_ItemSend event handler to add a custom property.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"donald" wrote in message oups.com...
If you access Outlook through COM-automation and create a new MailItem,
you lose access to it when it is send.

"The subject has been moved or deleted" or some such error message you
get, if you try to access any of the mails properties after it has been
send.

I know i need to keep track of the MailItem where it is using
MAPIFolder.Items.ItemAdd event on the "Sent Items" folder and add a
unique custom property to the message and then search for that message
in the "Sent Items" folder.

I got the ItemAdd and it find it but i need to check it is the right
message so how can i add a custom property to all the MailItem in
outlook?

Thanks

Donald

  #3  
Old February 1st 06, 05:26 PM posted to microsoft.public.outlook.program_addins
donald
external usenet poster
 
Posts: 25
Default Losing handle to MailItem when send

I could do it with that yes but i would like to do it with ItemAdd
because i basic set it all up now. i am putting the custom property in
side Mileage but i can't read what is in Mileage i get a error about
late binding

this is my code:

Private Sub currentoutbox_ItemAdd(ByVal Item As Object) Handles
currentoutbox.ItemAdd

Dim subject As String
Dim Mileage As String

subject = Item.Subject

Try
Mileage = Item.Mileage
Catch ex As Exception
MsgBox(ex.ToString)
End Try

End Sub

  #4  
Old February 1st 06, 05:46 PM posted to microsoft.public.outlook.program_addins
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Losing handle to MailItem when send

Never, ever change items in the Outbox. Either change them in the Sent Items folder or use Application_ItemSend.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"donald" wrote in message oups.com...
I could do it with that yes but i would like to do it with ItemAdd
because i basic set it all up now. i am putting the custom property in
side Mileage but i can't read what is in Mileage i get a error about
late binding

this is my code:

Private Sub currentoutbox_ItemAdd(ByVal Item As Object) Handles
currentoutbox.ItemAdd

Dim subject As String
Dim Mileage As String

subject = Item.Subject

Try
Mileage = Item.Mileage
Catch ex As Exception
MsgBox(ex.ToString)
End Try

End Sub

  #5  
Old February 1st 06, 05:54 PM posted to microsoft.public.outlook.program_addins
donald
external usenet poster
 
Posts: 25
Default Losing handle to MailItem when send

i am chnaging that in the Sent Items

i have currentoutbox = _NameSpace.Folders.Item("MailBox -
XXXXXXXXXX").Folders("Sent Items").Items

  #6  
Old February 1st 06, 05:58 PM posted to microsoft.public.outlook.program_addins
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Losing handle to MailItem when send

But you're using the Add event on the OUtbox's Items collection:

Private Sub currentoutbox_ItemAdd(ByVal Item As Object) Handles
currentoutbox.ItemAdd


Never use that folder's ItemAdd event. Use the ItemAdd event in Sent Items or use Application_ItemSend.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"donald" wrote in message ups.com...
i am chnaging that in the Sent Items

i have currentoutbox = _NameSpace.Folders.Item("MailBox -
XXXXXXXXXX").Folders("Sent Items").Items

  #7  
Old February 1st 06, 07:09 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Losing handle to MailItem when send

Application.ItemSend event fires before the mesasge is first moved to the
Outbox and then to the Sent Items folder, so you you can safely add your
custom prop in that event handler.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"donald" wrote in message
oups.com...
If you access Outlook through COM-automation and create a new MailItem,
you lose access to it when it is send.

"The subject has been moved or deleted" or some such error message you
get, if you try to access any of the mails properties after it has been
send.

I know i need to keep track of the MailItem where it is using
MAPIFolder.Items.ItemAdd event on the "Sent Items" folder and add a
unique custom property to the message and then search for that message
in the "Sent Items" folder.

I got the ItemAdd and it find it but i need to check it is the right
message so how can i add a custom property to all the MailItem in
outlook?

Thanks

Donald



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
How do I set up Outlook for email without losing contacts Lorraine Outlook - General Queries 3 March 1st 06 03:37 PM
How can I create a MailItem that displays like a received MailItem ? Clive Outlook - Using Forms 0 February 27th 06 05:14 PM
Will Outlook Handle These Needs? Janet Outlook - Calandaring 0 February 17th 06 11:43 PM
How can I Print out my contacts without losing longer note entrys BBusyBookworm Outlook - Using Contacts 1 February 15th 06 04:10 PM
dialog comes up when trying to access mailItem Neo Add-ins for Outlook 3 January 16th 06 10:56 PM


All times are GMT +1. The time now is 01:02 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.