Collaboration Data Objects (CDO)

Hallo zusammen,

Kürzlich hat Microsoft das MAPI CDO 1.2.1 mit der Versionsnummer 08.03.0.8309.000 veröffentlicht. Diese Version unterstützt auch Exchange 2013. http://www.microsoft.com/en-ie/download/details.aspx?id=36771

Das CDO muss mit der 32 Bit Umgebung aufgerufen werden. Nimmt man das x64 Bit CScript, so kann das MAPI.Session Objekt nicht erstellt werden.

Mit dem 32 Bit CScript funktionierts dann wunderbar.

Dim objSession
Set objSession = CreateObject ("MAPI.Session")

strProfile = "ICESRV01" & vblf & "boa"

WScript.Echo "Login to Mailbox..."
'Logon with Outlook Profile
'objSession.Logon ("Outlook")

'Logon without Oulook Profile
objSession.Logon ,,,True,,False,strProfile

WScript.Echo "Login Sucessful"

Set objAddressEntry = objSession.CurrentUser
WScript.Echo "objAddressEntry: " & objAddressEntry

Set objFolder = objSession.GetDefaultFolder(CdoDefaultFolderCalendar)
WScript.Echo "Calendar: " & objFolder.name


' Get inbox of current session
Set objInbox = objSession.Inbox
WScript.Echo "Inbox: " & objInbox.name

WScript.Echo "List Messages"
Set objMessagesColl = objInbox.Messages
If Not objMessagesColl Is Nothing Then ' there are child folders
      Set objMessage = objMessagesColl.GetFirst
      While Not objMessage Is Nothing ' loop through all children
 WScript.Echo "Subject: " & objMessage.Subject
        Set objMessage = objMessagesColl.GetNext
      Wend
End if

WScript.Echo "List Folders"
' Get folders collection
Set objFoldersColl = objInbox.Folders
If Not objFoldersColl Is Nothing Then ' there are child folders
      Set objOneSubfolder = objFoldersColl.GetFirst
      While Not objOneSubfolder Is Nothing ' loop through all children
 WScript.Echo "Folder: " & objOneSubfolder.name
        Set objOneSubfolder = objFoldersColl.GetNext
      Wend
End if

WScript.Echo "Logoff..."
objSession.Logoff
WScript.Echo "Done"

Weitere Links zur CDO Programmierung

Grüsse
Andres Bohren