Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Outlook Event ObjectEventAdd Capture ItemSend Attachments
In term of requirements, there is really just one. Immediately remove any attachments from e-mail messages as the user attaches them. If there is any delay in the removal process, then a second requirement would be to stop the user from sending the message until the attachments are removed.
Any help would be greatly appreciated.
Here is my attempt a coding up a WinBatch script that sits waiting for a user to attempt to send a message in Outlook. Note this code expects Outlook to already be running.
; How to cancel the ItemSend event in response to user input. ; NOTE the ObjectEventAdd routine must be called before the event procedure can be called by Microsoft Outlook. #DefineFunction myOlApp_ItemSend(objItem,0) subject = objItem.Subject Pause('Event Notification','User is sending an email, add code here to remove attachments') Pause('Email subject is', subject) Return #EndFunction ;Assume running copy of Outlook myOlApp = ObjectGet(,"Outlook.Application") ; Event Add ObjectEventAdd(myOlApp, "ItemSend", "myOlApp_ItemSend") ; Loop until the email is sent by the user in Outlook or until the Esc key is pressed BoxOpen("Waiting for a registry key to change.", "Press ESC key to quit") While 1 If WaitForKeyEX("{ESC}", 1) == 1 Break ; Esc key pressed EndIf EndWhile BoxShut() ; Remove the event. ObjectEventRemove(myOlApp, "ItemSend") ; cleanup myOlApp = 0 Exit
Now for deleting the attachments: the Outlook 'Attachment Object' 'Delete method' looks interesting: http://msdn.microsoft.com/en-us/library/bb175152(office.12).aspx
This section of the tech database has lots of Outlook Com examples. Maybe you can find one that will help get you started: http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/OLE~COM~ADO~CDO~ADSI~LDAP/OLE~and~Outlook
Article ID: W18093
Filename: ObjectEventAdd To Capture ItemSend Event.txt
File Created: 2014:07:18:09:51:38
Last Updated: 2014:07:18:09:51:38