I don't think that would work. Why bother? Use Set objSession=EventDetails.Session and then go from there. No need to get the inspector object etc. You can get the message object directly from the EventDetails object. Set objMessage = objSession.GetMessage(EventDetails.MessageID, NULL). Two lines of code. Please go to www.cdolive.com and read about Event Scripting. There's a wealth of information there. Hell they even have a sample folder script that saves attachments on incoming messages.
S. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, December 03, 2001 11:34 AM To: Exchange Discussions Subject: RE: Saving Attachments using VBScript/Folder Agents Try this before your code: Assuming that you have Outlook as a Client an using his Object Model: Dim objSession Set objSession = CreateObject("Outlook.Application") 'Thats your Code Error you miss this 2 lines above. Creating and Setting the Variable objSession.Session.Logon ProfileInfo "", "", False, True, 0, True 'those parameters apply only if you have more then 1 profile Now in your code replace "Application" with "objSession": Set myItem = objSession.ActiveInspector.CurrentItem ... António José E Cabrita DSI - Gestão Operacional de Rede Av. Casal Ribeiro, 59 - 1º Telefone : 21 318 11 52 Ext. 451152 -----Original Message----- From: Soysal, Serdar [mailto:[EMAIL PROTECTED]] Sent: Monday, December 03, 2001 3:24 PM To: Exchange Discussions Subject: RE: Saving Attachments using VBScript/Folder Agents The reason is the Application object only applies when you're writing scripts for Office applications. Same thing with the Inspector objects and such. When you have a folder script, you have to use CDO. You're trying to use the Outlook Object Model in your folder script which won't work. I suggest you go through www.cdolive.com thoroughly and learn more about event scripting. S. -----Original Message----- From: Masthanaiah Cheekavolu [mailto:[EMAIL PROTECTED]] Sent: Monday, December 03, 2001 12:27 AM To: Exchange Discussions Subject: Saving Attachments using VBScript/Folder Agents Hi, VBScript online help says the following: If you use VBScript, you do not create the Application object. This example shows how to perform the same task using VBScript. Set myItem = Application.ActiveInspector.CurrentItem Set myAttachments = myItem.Attachments myAttachments.Item(1).SaveAsFile "C:\My Documents\" & _ myAttachments.Item(1).DisplayName I am using the above given code ( ex from VBScript online help) in a folder agent script in Outlook to save a log file (comes as an attachment of an email ). I am getting the following error: 12/02/01 20:49:56 Run time error at line 20. Source: Microsoft VBScript runtime error Error: 800a01f4. Description: Variable is undefined: 'Application'. Any idea what is the mistake that I am doing here? The equivalent VBA code given in the online help perfectly works fine. thanks, -Masthan. This message is confidential and may also be legally privileged. If you are not the intended recipient, please notify us immediately. You should not copy it or use it for any purpose, nor disclose it's contents to any other person. The views and opinions expressed in this e-mail message are the author's own and may not reflect the views and opinions of Wilco International. _________________________________________________________________ List posting FAQ: http://www.swinc.com/resource/exch_faq.htm Archives: http://www.swynk.com/sitesearch/search.asp To unsubscribe: mailto:[EMAIL PROTECTED] Exchange List admin: [EMAIL PROTECTED] _________________________________________________________________ List posting FAQ: http://www.swinc.com/resource/exch_faq.htm Archives: http://www.swynk.com/sitesearch/search.asp To unsubscribe: mailto:[EMAIL PROTECTED] Exchange List admin: [EMAIL PROTECTED] _________________________________________________________________ List posting FAQ: http://www.swinc.com/resource/exch_faq.htm Archives: http://www.swynk.com/sitesearch/search.asp To unsubscribe: mailto:[EMAIL PROTECTED] Exchange List admin: [EMAIL PROTECTED] _________________________________________________________________ List posting FAQ: http://www.swinc.com/resource/exch_faq.htm Archives: http://www.swynk.com/sitesearch/search.asp To unsubscribe: mailto:[EMAIL PROTECTED] Exchange List admin: [EMAIL PROTECTED]