StartDownloadsServiceSamplesWorkshopsContact DeutschEnglish
 
Samples
General
Outlook®
 
Awarded by
Microsoft since 2005:
mvp logo
VBOffice Info
Visitors1751191
Impressions6568223
Links
Imprint
Privacy Policy
Contact
CDO: Access a MailItem via the MAPI library
Author: Michael BauerHomepage
Date: 20.01.2006Accessed: 27520
  
Description

CDO 1.21 is not as comfortable to use as the Outlook object model. On the other hand, it provides you with more functionality than the OOM does.

The CDO 1.21 library is an optional component that can be found on the Office or Outlook installation disk. Because it is not installed by default you might make it up via Control Panel, Add/Remove programs; select Microsoft Office (or Outlook) and click to Add/Edit features. Then select 'Collaboration Data Objects' from the collection of Outlook components.

The following sample demonstrates how to logon a MAPI session and get the corresponding MAPI object from an Outlook MailItem. Because the GetMessage function needs the Outlook item's EntryID, the item must be stored once beforehand.

Public Function GetMessage(oObj As Object) As MAPI.Message
  On Error Resume Next
  Dim oSess As MAPI.Session
  Dim sEntryID As String
  Dim sStoreID As String

  sEntryID = oObj.EntryID
  sStoreID = oObj.Parent.StoreID

  Set oSess = CreateObject("MAPI.Session")
  oSess.LogOn , , False, False, , True
  Set GetMessage = oSess.GetMessage(sEntryID, sStoreID)
End Function
 
 

ReplyAll alerts you before unintentionally replying all, or if you are a confidential BCC recipient of the ... [more]

 

Access the master category list in the blink of an eye, share your categories in a network, get a reminder service, and ... [more]

 

SAM automatically sets the sender, signature, and folder for sent items, for instance based on the recipient ... [more]

 

OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or ... [more]