CDOLive LLC The Premier Resource for Microsoft Collaboration Data Objects             

Office Document Posting Sample Application

This sample is a simple Microsoft Visual Basic application that posts a selected file to an Outlook/Exchange Server folder. The file will be posted the same way as an Outlook document item. This is especially useful if you want to programmatically save files, e.g. a Word document, to an Outlook/Exchange Server folder like it is done when drag & drop it with the Outlook user interface:

Known Issues

This sample can be used only with Microsoft Outlook installed in 'Corporate or Workgroup Mode', using the MAPI provider to access Microsoft Exchange Server.


Microsoft Exchange Server 5.x in US English version must be installed. Also make sure that Microsoft Outlook is installed in Corporate or Workgroup mode and running properly.

After installing the Outlook security update this sample will stop working properly because of changes made by Microsoft. For more info on the Outlook security update please check Outlook e-mail Security Update

Note that the Office/Outlook 2000 setup does not install CDO 1.21 by default. You need to run the Office/Outlook 2000 setup and add CDO 1.21 as custom option.

Checked Build

If you would like to use this sample with another language version of Microsoft Exchange Server or Microsoft Outlook, it is possible that the sample will not work without modifications. Please consult the source code for more information. This sample is build and checked for a proper function using the following environment:

  • Microsoft Windows NT Server 4.0, with Service Pack 5, US English - International
  • Microsoft Exchange Server 5.5, with Service Pack 3, US English - International
  • Microsoft Outlook 2000, US English - International
  • Microsoft Visual Basic 6.0, with Service Pack 3, US English - International
Installation and Configuration
ComponentDescription 11 Kbyte) Visual Basic Project The Microsoft Visual Basic 6 project.

To use the sample, unzip it into a separate folder. Make sure that CDO 1.21 component is registered in your machine and open the project file. If you not have Outlook 2000 installed it is possible that you will get an error that CDO.DLL cannot be found. If so, open the references and select the proper CDO 1.21 library reference.

Load the application into the Microsoft Visual Basic IDE and click "Run", "Start" to run the application and select the MAPI profile that should be used. A folder browser dialog is displayed and you can select a folder of your mailbox or a public folder. Then click on the Add File button to display an Select File dialog. Select a file and click open. The file will be posted to the selected folder and the proper message class is determined automatically from the Windows Registry.