![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
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. |
Ads |
#2
|
|||
|
|||
![]()
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. |
#3
|
|||
|
|||
![]()
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. |
#4
|
|||
|
|||
![]()
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. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Cannot open shared mailbox | Robert at L3 | Outlook - Calandaring | 3 | August 4th 08 04:56 PM |
Open another users mailbox within my Outlook | MS User2006 | Outlook - General Queries | 2 | July 14th 06 07:30 PM |
How do I open a folder in another users mailbox? | Higgsy | Outlook and VBA | 2 | July 10th 06 05:46 PM |
Can't open calendars after mailbox moves. | X-Jack | Outlook - Calandaring | 1 | April 14th 06 07:26 PM |
PRF setting to open additional mailbox | J Y | Outlook - Installation | 2 | March 17th 06 02:51 AM |