![]() |
| 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. |
|
|||||||
| Tags: mailitems, pressing, sendbutton, work |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I'have written a COM add-in for Outlook using VC++. This COM-Addin should detect new send mails. After sending a mail (with several attachments) I have to separate all attachements from mailItem, then save each attachment as a single file, save mailitem without attachments as msg file, and save the mailitem themself - complete with all attachments - as msg-file too. I've tried to detect the Application.SendItem-Event. This point of time seems to be early, because some operations failed with Unknown Error. - MailItem.Copy failed (with unknown error) - Deleting Attachments and save Mailitem as msg-file works, but - Discard changes by calling MailItem.Close(olDiscard) failed (with unknown error) Ok, next idea was to do the work later while monitoring Outbox-Folder. In this case I've stored Id of each Mailitem when the MAPIFolder.ItemAdd-Event occured. So, I was able to determine, which Mailitem was removed, when the MAPIFolder.ItemAdd-Event was fired. But the monitoring worked only, when outlook was not configured with option "automatically send new emails". When this option is aktivated, then MAPIFolder.ItemAdd-Event has no valid parameter (given MailItem is null). Any idea? Best regards Darius |
| Ads |
|
#2
|
|||
|
|||
|
Monitor each new Inspector as it's added to the Inspectors collection. Trap
the Item.Send event for the Inspector.CurrentItem. Cancel the send and then you can copy the item, move it or alter it as you want. You might need a timer event to start your processing of the item after the Send event concludes, that's most important when using WordMail. The Application level send event is too late, not too early, for what you want. -- 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 "Darius" wrote in message ... Hi, I'have written a COM add-in for Outlook using VC++. This COM-Addin should detect new send mails. After sending a mail (with several attachments) I have to separate all attachements from mailItem, then save each attachment as a single file, save mailitem without attachments as msg file, and save the mailitem themself - complete with all attachments - as msg-file too. I've tried to detect the Application.SendItem-Event. This point of time seems to be early, because some operations failed with Unknown Error. - MailItem.Copy failed (with unknown error) - Deleting Attachments and save Mailitem as msg-file works, but - Discard changes by calling MailItem.Close(olDiscard) failed (with unknown error) Ok, next idea was to do the work later while monitoring Outbox-Folder. In this case I've stored Id of each Mailitem when the MAPIFolder.ItemAdd-Event occured. So, I was able to determine, which Mailitem was removed, when the MAPIFolder.ItemAdd-Event was fired. But the monitoring worked only, when outlook was not configured with option "automatically send new emails". When this option is aktivated, then MAPIFolder.ItemAdd-Event has no valid parameter (given MailItem is null). Any idea? Best regards Darius |
|
#3
|
|||
|
|||
|
In my case I'm not able to catch 'NewInspector'-Event in the Inspectors
Collection, because the action (sending a mail) will be initiate from a diffrent tool using Simple Mapi (Function: MAPISendMail). After the tool called the MAPISendMail-Function, a new Mailwindow will be opened. In this case a new Outlook Inspector Window, because Outlook is set as default (mapi) mail client. But the event 'NewInspector' will not be fired. Trying to catch the 'NewInspector'-Event, by initiate sending a mail direct from Outlook, works fine. Is their another way to work with MailItems when they will be send? Ken Slovak - [MVP - Outlook] schrieb: Monitor each new Inspector as it's added to the Inspectors collection. Trap the Item.Send event for the Inspector.CurrentItem. Cancel the send and then you can copy the item, move it or alter it as you want. You might need a timer event to start your processing of the item after the Send event concludes, that's most important when using WordMail. The Application level send event is too late, not too early, for what you want. |
|
#4
|
|||
|
|||
|
No, in that case you're out of luck. Not only does NewInspector not fire but
after the item opens it's not even in the Inspectors collection. -- 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 "Darius" wrote in message ... In my case I'm not able to catch 'NewInspector'-Event in the Inspectors Collection, because the action (sending a mail) will be initiate from a diffrent tool using Simple Mapi (Function: MAPISendMail). After the tool called the MAPISendMail-Function, a new Mailwindow will be opened. In this case a new Outlook Inspector Window, because Outlook is set as default (mapi) mail client. But the event 'NewInspector' will not be fired. Trying to catch the 'NewInspector'-Event, by initiate sending a mail direct from Outlook, works fine. Is their another way to work with MailItems when they will be send? |
|
#5
|
|||
|
|||
|
Is there no other chance to work with mailitems befor or after sending?
If not, is their a way (dirrent API or methode) to change the initiating tool, which uses currently Simple Mapi (function: MAPISendMail) for sending an Email with the purpose that Outlook coult recognize a NewMail-Inspector? Ken Slovak - [MVP - Outlook] schrieb: No, in that case you're out of luck. Not only does NewInspector not fire but after the item opens it's not even in the Inspectors collection. |
|
#6
|
|||
|
|||
|
You could avoid using Send To completely and code alternatives that use
Outlook automation. About the only thing I can think of and it's not only a hack but unresearched and only partially complete would be to iterate all open windows using the Win32 API and then find all open windows that have a name of "rctrl_renwnd32" (all Outlook based windows) and then check the captions. You'd somehow have to correlate all those open windows of that name with various open Outlook windows and see which one was the new mail item. How you'd go from that window to an Outlook Inspector I have no idea. -- 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 "Darius" wrote in message ... Is there no other chance to work with mailitems befor or after sending? If not, is their a way (dirrent API or methode) to change the initiating tool, which uses currently Simple Mapi (function: MAPISendMail) for sending an Email with the purpose that Outlook coult recognize a NewMail-Inspector? |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Add send/receive button | NEUF-ELDER | Outlook - Installation | 1 | September 20th 06 01:49 PM |
| Send/Receive Button | TJ | Outlook - General Queries | 1 | February 16th 06 06:07 PM |
| how do I send a letter without a send button on the toolbar? | son | Outlook - General Queries | 1 | February 16th 06 04:57 PM |
| send button is missing only when I log in | ottoschmitty | Outlook - Installation | 3 | February 8th 06 03:33 PM |
| Send - Receive Button Still Fails to appear | John | Outlook - Installation | 0 | January 18th 06 08:42 AM |