![]() |
CDO Open Mailbox
I posted this in the VBScript forum, but have not recieved a response. I was
wondering if anyone had an example of how to connect to a mailbox (exchange 2003) via VBScript using CDO. I am looking to enumerate through the items int he inbox and perform some tasks. I just need a starting point, as I have not used CDO for anything but sending messages int he past. |
CDO Open Mailbox
For CDO 1.21 you really want to explore the www.cdolive.com Web site. It has
tons of CDO sample code plus various property tags including lots of undocumented property tags. Where is this code running, a form with VBScript or in Outlook VBA? This sample is VBA style, just comment out the As clauses to make it VBScript compatible: Dim oSession As MAPI.Session Set oSession = CreateObject("MAPI.Session") oSession.Logon "", "", False, False ' Const CdoDefaultFolderInbox = 1 ' uncomment for VBScript code Dim oFolder As MAPI.Folder Set oFolder = oSession.GetDefaultFolder(CdoDefaultFolderInbox) Dim colMessages As MAPI.Messages Set colMessages = oFolder.Messages Dim oMessage As MAPI.Message For Each oMessage In colMessages 'whatever Next -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Bob Smith" wrote in message ... I posted this in the VBScript forum, but have not recieved a response. I was wondering if anyone had an example of how to connect to a mailbox (exchange 2003) via VBScript using CDO. I am looking to enumerate through the items int he inbox and perform some tasks. I just need a starting point, as I have not used CDO for anything but sending messages int he past. |
CDO Open Mailbox
Thanks for your help.
I was able to connect to a mailbox using VBscript with a machine that is running outlook. The problem is however I need to do this on a machine that does not run outlook. The machine I need to get this working on does not have outlook installed, only the exchange system tools (2003 SP2). I recieve the following error; C:\temp\connectMailBox.vbs(7, 2) Collaboration Data Objects: [Collaboration Dat a Objects - [MAPI_E_LOGON_FAILED(80040111)]] I checked CDOLive and couldn't see how to egt CD working on a machine. "Ken Slovak - [MVP - Outlook]" wrote: For CDO 1.21 you really want to explore the www.cdolive.com Web site. It has tons of CDO sample code plus various property tags including lots of undocumented property tags. Where is this code running, a form with VBScript or in Outlook VBA? This sample is VBA style, just comment out the As clauses to make it VBScript compatible: Dim oSession As MAPI.Session Set oSession = CreateObject("MAPI.Session") oSession.Logon "", "", False, False ' Const CdoDefaultFolderInbox = 1 ' uncomment for VBScript code Dim oFolder As MAPI.Folder Set oFolder = oSession.GetDefaultFolder(CdoDefaultFolderInbox) Dim colMessages As MAPI.Messages Set colMessages = oFolder.Messages Dim oMessage As MAPI.Message For Each oMessage In colMessages 'whatever Next -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Bob Smith" wrote in message ... I posted this in the VBScript forum, but have not recieved a response. I was wondering if anyone had an example of how to connect to a mailbox (exchange 2003) via VBScript using CDO. I am looking to enumerate through the items int he inbox and perform some tasks. I just need a starting point, as I have not used CDO for anything but sending messages int he past. |
CDO Open Mailbox
It's the logon.
The logon arguments "", "", False, False can only be used when a MAPI session is already running (Outlook is running). Otherwise you have to specify a profile to use or start a profile logon dialog. On http://www.cdolive.com/cdo5.htm look at the "Log on, send a message and log off" section. That shows how to use different logons depending on existing conditions. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Bob Smith" wrote in message ... Thanks for your help. I was able to connect to a mailbox using VBscript with a machine that is running outlook. The problem is however I need to do this on a machine that does not run outlook. The machine I need to get this working on does not have outlook installed, only the exchange system tools (2003 SP2). I recieve the following error; C:\temp\connectMailBox.vbs(7, 2) Collaboration Data Objects: [Collaboration Dat a Objects - [MAPI_E_LOGON_FAILED(80040111)]] I checked CDOLive and couldn't see how to egt CD working on a machine. "Ken Slovak - [MVP - Outlook]" wrote: For CDO 1.21 you really want to explore the www.cdolive.com Web site. It has tons of CDO sample code plus various property tags including lots of undocumented property tags. Where is this code running, a form with VBScript or in Outlook VBA? This sample is VBA style, just comment out the As clauses to make it VBScript compatible: Dim oSession As MAPI.Session Set oSession = CreateObject("MAPI.Session") oSession.Logon "", "", False, False ' Const CdoDefaultFolderInbox = 1 ' uncomment for VBScript code Dim oFolder As MAPI.Folder Set oFolder = oSession.GetDefaultFolder(CdoDefaultFolderInbox) Dim colMessages As MAPI.Messages Set colMessages = oFolder.Messages Dim oMessage As MAPI.Message For Each oMessage In colMessages 'whatever Next -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Bob Smith" wrote in message ... I posted this in the VBScript forum, but have not recieved a response. I was wondering if anyone had an example of how to connect to a mailbox (exchange 2003) via VBScript using CDO. I am looking to enumerate through the items int he inbox and perform some tasks. I just need a starting point, as I have not used CDO for anything but sending messages int he past. |
All times are GMT +1. The time now is 07:04 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com