A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

CDO Open Mailbox



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old December 2nd 08, 10:45 PM posted to microsoft.public.outlook.program_vba
Bob Smith
external usenet poster
 
Posts: 34
Default 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.

Ads
  #2  
Old December 3rd 08, 04:15 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default 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.


  #3  
Old December 4th 08, 08:24 PM posted to microsoft.public.outlook.program_vba
Bob Smith
external usenet poster
 
Posts: 34
Default 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.



  #4  
Old December 5th 08, 03:30 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default 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.




 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
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


All times are GMT +1. The time now is 09:06 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-2025 Outlook Banter.
The comments are property of their posters.