CDOLive LLC The Premier Resource for Microsoft Collaboration Data Objects             

Code Sample Library

The Code Sample Library provides you with CDO applications written in Microsoft Visual Basic and Microsoft Visual Basic Scripting Edition to use with Microsoft Exchange Server 5.5 Scripting and Routing, Microsoft Outlook 9x/2000 Forms and Microsoft Active Server Pages or standalone applications. Detailed information about the requirements and the prerequisites are included with each sample.

All samples are provided free by the CDOLive members or other contributors without any warranties and support. Please read our legal disclaimer before you use any samples provided below. Feel free to use them in your own applications.

You can also download all samples in one file allsamples.zip. Note that the descriptions of the samples are not included. If you are new to CDO & ASP we recommend to read the descriptions before you download and use one of the samples. Just click on the floppy disk symbol to jump into a particular sample description.

Also the Microsoft sample applications (see Microsoft Sample Applications) are not included to avoid a huge download file.

Posted Type Submitted Description
December 13, 2000 Exchange Server 5.5 Scripting Agent Siegfried Weber, CDOLive Global Address List to Outlook Contacts Conversion Agent. This sample can be used to automatically create Outlook contact items with an Exchange 5.5 Scripting Agent from all entries of the Global Address List (GAL). This is especially useful if you want to synchronize your GAL with a handheld device, like a Palm, which doesn't allow to synchronize the GAL but supports Outlook contact items.

The latest update adds the Exchange Organization name as category to provide the ability to use a grouped view on a PDA.
December 13, 2000 Active Server Pages Application Siegfried Weber, CDOLive

Blackstone-Millville Regional School District
Outlook Web Access Address Book Enhancement. This sample enables the feature to browse the several Exchange Address Book as option on the Outlook Web Access navigation bar by modifying some of the built-in files of OWA and adding some custom code.

The latest update fixes a bug where Netscape browser were unable to view the page correctly. Thanks to the staff of the Blackstone-Millville Regional School District for fixing it and providing the correct code for free.

Posted Type Submitted Description
August 31, 2000 Windows Scripting Host Script Siegfried Weber, CDOLive
Steven M. Johnson, Cedar Point Communications
In/Out Board Windows Scripting Host Script. This sample Windows Scripting Host script can be used to create an HTML file on a scheduled basis that includes all members of a particular Exchange Server distribution list free/busy information.

The latest update fixes a bug where the displayed information is one hour off. Thanks to Steven M. Johnson for fixing it and providing the corrected code for free.
August 31, 2000 Outlook 98/2000 form Siegfried Weber, CDOLive Outlook Custom Categories Forms. This sample Outlook forms can be used to create custom categories in an Exchange Server Public Folder. One Outlook form is included to manage the custom categories and the second form shows how to use them with your own custom Outlook forms implementation.
August 31, 2000 Exchange Server 5.5 Scripting Agent Martin Luckfiel, Siemens Business Services Outlook Contact Distribution List Agent. This sample can be used to automatically create Outlook distribution list items with an Exchange 5.5 Scripting Agent. This sample has been contributed by Martin Luckfiel of Siemens Business Services, Berlin - Germany.
August 31, 2000 Visual Basic 6.0 Application Siegfried Weber, CDOLive Outlook Contact Item Viewer. This sample can be used to view Outlook contact item data without having Outlook running. This is especially useful if you want to read Outlook contact data without having an assigned form code to run.
February 15, 2000 Outlook 2000 VBA macro Siegfried Weber, CDOLive Modify Default Folder Names Macro. This sample can be used to change all Outlook default folder names. This is especially useful if you use multiple languages of Outlook with Exchange server. The Outlook default folders are created in the language of the Outlook client that is used to open the mailbox the first time.
February 15, 2000 Outlook 2000 VBA macro Siegfried Weber, CDOLive Modify Outlook Contact RTF-enabled Setting Macro. This sample allows to changes the RTF-enabled flag on all selected Outlook contact items. By default you must open each Outlook contact and toggle the RTF-enabled flag for each e-mail address manually. Use this sample to change the RTF-enabled flag in bulk by just selected the desired contacts and start the macro.
February 15, 2000 Outlook 98/2000 form Siegfried Weber, CDOLive Calendar Shortcut Form. This sample can be used to simulate Outlook folder shortcuts in a particular folder. It is especially useful if you want to create a Exchange public folder where your team shares shortcuts to each team member calendar.
December 23, 1999 Active Server Pages Application Siegfried Weber, CDOLive Outlook Web Access Public Folder Contacts Enhancement. This sample enables Outlook contacts in public folders by modifying some of the built-in files of OWA. Instead of doing this manually you can download the modified files for OWA 5.5 SP3 US English here.
December 23, 1999 Exchange Server 5.5 Scripting Agent Siegfried Weber, CDOLive Automatic Flagging Incoming Messages Script. This sample flags all incoming messages with the Outlook flag. It also sets the required action to "Call" and the due date to the next day. This is especially useful if you want to automate the task of flagging incoming messages without using the Outlook Rules Wizard.
December 23, 1999 Exchange Server 5.5 Scripting Agent Siegfried Weber, CDOLive Appointment Reminder Paging Script. This sample sends appointment reminders to a pager. This is especially useful if you want to get reminders at your pager without having Outlook running on your desktop.
December 23, 1999 Exchange Server 5.5 Scripting Agent Siegfried Weber, CDOLive Automatic Out-of-Office Assistant Switching Script. This sample enables/disables the "Out of Office" assistant of an Exchange Server mailbox if a user creates an appointment item in his/her primary calendar and set the "Show time as:" to "Out of Office". This is especially useful if you want to automate the task of enabling/disabling the "Out of Office" assistant for each user using simple calendar entries.
December 23, 1999 Visual Basic 6.0 Application Siegfried Weber, CDOLive Outlook AutoArchive Settings Viewer. This is a simple application that displays the Outlook AutoArchive settings of a particular mailbox folder using CDO 1.2x. This is especially useful if you e.g. want to change the path to the auto archive file for all folders of a mailbox programmatically.
December 23, 1999 Exchange Server 5.5 Scripting Agent Siegfried Weber, CDOLive Automatic Message Responding Script. This sample is an auto responder that replies to all incoming messages with a customized message body. It responds to the message originator only and ignores delivery reports, non-delivery reports and "Out of Office" messages. This is especially useful if you want to build a customer support mailbox that replies to all incoming requests immediately without creating message loops.
December 23, 1999 Exchange Server 5.5 Scripting Agent Siegfried Weber, CDOLive Automatic Message Forwarding Script. This sample forwards all incoming messages and retains the Rich Text Format (RTF) message body if the originator (including custom recipients or one-off addresses) supports RTF/HTML-formatted messages. This is especially useful if you want to forward RTF or HTML-formatted messages to another recipient which is not available on your Microsoft Exchange Server.
December 23, 1999 Visual Basic 6.0 Application Siegfried Weber, CDOLive Office Document Posting Application. This is a simple 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.
December 23, 1999 Visual Basic 6.0 Application Siegfried Weber, CDOLive Folder Permission Viewer Application. It uses the ACL COM component provided by Microsoft to build a simple folder permission viewer including a folder browser dialog which associates each folder type with the appropriate Outlook icon.
December 23, 1999 Active Server Pages Application Siegfried Weber, CDOLive Threaded Discussion Forum Web Application. This ASP application displays a public folder of a Microsoft Exchange server via CDO anonymous access into a threaded discussion forum, without using the standard Outlook Web Access interface.
March 28, 1999 Active Server Pages Application Siegfried Weber, CDOLive Exchange Phone List Web Application. This ASP application displays the global address list of a Microsoft Exchange server via CDO anonymous access into a HTML page, without using the standard Outlook Web Access interface.

The application has been tested with Windows 2000 Server & Exchange 2000 Server and slightly modified to ensure it runs on Exchange 2000 Server and access the Windows 2000 Active Directory to provide the same functionality as with previous version of Exchange Server.
March 01, 1999 Active Server Pages Application Siegfried Weber, CDOLive Customer Contact Web Application. This ASP application displays a public folder with Outlook contact items via CDO anonymous access into a Contact table HTML page, without using the standard Outlook Web Access interface.

The application has been tested with Windows 2000 Server & Exchange 2000 Server and slightly modified to ensure it runs on Exchange 2000 Server and provide the same functionality as with previous version of Exchange Server.
March 01, 1999 Active Server Pages Application Siegfried Weber, CDOLive Internet Links Web Application. This ASP application displays a public folder with Outlook contact items via CDO anonymous access into a Internet Links list HTML page, without using the standard Outlook Web Access interface.

The application has been tested with Windows 2000 Server & Exchange 2000 Server and slightly modified to ensure it runs on Exchange 2000 Server and provide the same functionality as with previous version of Exchange Server.
March 01, 1999 Active Server Pages Application Siegfried Weber, CDOLive Bulletin Board Web Application. This ASP application displays a public folder with standard messages via CDO anonymous access into a Bulletin Board HTML page, without using the standard Outlook Web Access interface.

With the latest addition it is also possible to read attachments that are added to the headline in the public folder.

The application has been tested with Windows 2000 Server & Exchange 2000 Server and slightly modified to ensure it runs on Exchange 2000 Server and provide the same functionality as with previous version of Exchange Server.
December 13, 1998
June 6, 1999
Outlook 98/2000 form Siegfried Weber, CDOLive Folder Property Viewer Outlook Form. This sample Outlook 98/2000 form can be used to view configuration information, including permissions, of a particular private or public folder. This sample is built with CDO 1.x, without using ADSI/LDAP. It shows exactly how to find a particular private or public folder and access the MAPI properties using CDO 1.x.

With the latest update it is now possible to display the forms and views information associated with a public folder.
December 13, 1998 Exchange Server 5.5 Scripting Agent Siegfried Weber, CDOLive Attachment Extraction Folder Script. This sample extracts all attachments of an arrived message inside a particular public or private folder and saves them into the file system. It shows exactly how to save and remove attachments of a message.
December 13, 1998 Exchange Server 5.5 Scripting Agent Siegfried Weber, CDOLive Scheduled Message Sending Script. This sample sends a new message at a scheduled time and adds an attachment of the file system to the message. It shows exactly how to add attachments to a new message.
December 13, 1998
June 6, 1999
Outlook 98/2000 form Siegfried Weber, CDOLive Forms Property Viewer Outlook Form. This sample Outlook 98/2000 form can be used to view the content of a particular forms library of an Exchange Server or Outlook mailbox. This sample is built with CDO 1.x, without using MAPI. It shows exactly how to work with Outlook forms and hidden messages using CDO 1.x.

With the latest update it is now possible to display the forms last modification date/time and the modifier name.
December 13, 1998 Exchange Server 5.5 Scripting Agent Siegfried Weber, CDOLive Scheduled Mailbox Report Script. This sample creates a report of all mailboxes on a particular Microsoft Exchange server and sends the result attached to a message to a particular mailbox. It shows exactly how to use dynamically created profiles to access multiple mailboxes within a scripting agent.
December 13, 1998 Exchange Server 5.5 Scripting Agent Siegfried Weber, CDOLive Folder SPAM Filter Script. This sample deletes all messages which are arriving at a particular folder and containing a special keyword on the subject. The keyword must match with one stored in a file at the file system.
December 09, 1998
June 24, 1999
  Siegfried Weber, CDOLive Microsoft Sample Applications including the source code of  the 'Agent Editor', 'Routing Wizard' and a sample Outlook routing form, provided by Microsoft.

The latest update now includes three samples Microsoft released with the latest Platform SDK update. One is a COM object to read/write folder permissions, one is a COM object to read/write rules and the last one is a COM object to create a proper security identifier if a new mailbox is created programmatically with ADSI.
September 02, 1998 Exchange Server 5.5 Scripting Agent Siegfried Weber, CDOLive Item Message Class Changing Script. Changes the message class of all messages which are arriving at a particular folder.
September 02, 1998 Exchange Server 5.5 Scripting Agent Siegfried Weber, CDOLive Folder Cleanup Script. Deletes all messages which are arriving at a particular folder.
August 19, 1998
June 6, 1999
Outlook 98/2000 form Siegfried Weber, CDOLive Modify Mailbox Properties Outlook Form. This sample Outlook 98/2000 form can be used to modify the MAPI properties of an Exchange mailbox. This sample is built with CDO 1.2x, without using ADSI/LDAP. It shows exactly how to work with an address entry object and MAPI properties using CDO 1.2x.
With the latest update it is possible to display the "Direct reports" and "Distribution list membership" properties using a COM object helper app, because CDO 1.x is not capable of accessing these properties.
August 19, 1998
October 19, 1998
Exchange Server 5.5 Scripting Agent including an Outlook 98/2000 form Siegfried Weber, CDOLive Public Folder Update Notification Script. Sends a message to a distribution list if a new item is posted to a particular folder.

With the latest update it is possible to use a specific Outlook form to display the alert message, which gives the user the ability to open the new item with a simple click of a button.
August 19, 1998 Exchange Server 5.5 Scripting Agent including an Outlook 98/2000 form Siegfried Weber, CDOLive Anonymous Posting Script. Exchange Server Scripting Agent script for anonymous postings to a particular public folder.