Tải bản đầy đủ (.pdf) (72 trang)

Tài liệu Module 4: Incorporating CDO for Exchange 2000 into a Web Solution ppt

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (1.18 MB, 72 trang )








Contents
Overview 1
Introduction to CDO 2
CDO Architecture 6
The CDO for Exchange Object Model 8
Adding Messaging Functionality 14
Adding Contact Functionality 24
Adding Calendar Functionality 29
Administering Exchange 2000 by Using
CDO for Exchange Management 44
Lab A: Incorporating CDO for Exchange
into a Web Solution 48
Lab B: Performing Basic Exchange 2000
Administrative Tasks by Using CDO for
Exchange Management 58
Review 64

Module 4: Incorporating
CDO for Exchange 2000
into a Web Solution


Information in this document is subject to change without notice. The names of companies,
products, people, characters, and/or data mentioned herein are fictitious and are in no way intended


to represent any real individual, company, product, or event, unless otherwise noted. Complying
with all applicable copyright laws is the responsibility of the user. No part of this document may
be reproduced or transmitted in any form or by any means, electronic or mechanical, for any
purpose, without the express written permission of Microsoft Corporation. If, however, your only
means of access is electronic, permission to print one copy is hereby granted.

Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual
property rights covering subject matter in this document. Except as expressly provided in any
written license agreement from Microsoft, the furnishing of this document does not give you any
license to these patents, trademarks, copyrights, or other intellectual property.

 2000 Microsoft Corporation. All rights reserved.

Microsoft, Active Directory, ActiveX, FrontPage, Hotmail, JScript, MSN, Outlook, PowerPoint,
Visual Basic, Visual C++, Window Media, Visual InterDev, Visual Studio, Win32, Windows, and
Windows NT are either registered trademarks or trademarks of Microsoft Corporation in the
U.S.A. and/or other countries.

Other product and company names mentioned herein may be the trademarks of their respective
owners.


Project Lead: Samantha Smith
Instructional Designers: Sangeeta Garg (NIIT (USA) Inc.), Marilyn McCune
Instructional Software Design Engineer: William Rebozo
Subject Matter Experts: Jayme Bowers (ECMS Inc.), John Christian (ECMS Inc.),
Robert Ginsburg (ECMS Inc.), Frederick Volking (ECMS Inc
Technical Contributors: Thomas Rizzo, Brent Ingraham, Navin Kachroo, Robert Brown,
Alex Hopmann, Jim Reitz
Graphic Artist: Kirsten Larson (S&T Consulting)

Editing Manager: Lynette Skinner
Editors: Kelly Baker, Nancy Finch
Copy Editor: Ed McKillop (S&T Consulting)
Production Manager: Miracle Davis
Print Coordinator: Marlene Lambert (Online Training Solutions Inc.)
Online Production Coordinator: Jenny Boe
Test Manager: Eric R. Myers
Creative Director, Media/Sim Services: David Mahlmann
Web Development Lead: Lisa Pease
CD Build Specialist: Eric Wagoner
Localization Manager: Rick Terek
Operations Coordinator: John Williams
Manufacturing Support: Laura King; Kathy Hershey
Lead Product Manager, Release Management: Bo Galford
Program Manager, Knowledge Management: Josh Barnhill
Lead Product Manager, Knowledge Management: Janet Wilson
Group Manager, Courseware Infrastructure: David Bramble
Director, Developer Training: Juan Fernando Rivera
General Manager: Robert Stewart

Module 4: Incorporating CDO for Exchange 2000 into a Web Solution iii


Instructor Notes
This module provides students with the information necessary to use
Collaboration Data Objects (CDO) to create collaborative solutions based on
the Microsoft
®
Web Storage System. The module introduces CDO, discusses
the various versions of CDO available with Microsoft Windows

®
2000 and
Microsoft Exchange 2000 Server, and describes the CDO architecture and the
components of the CDO for Exchange 2000 Server object model. The module
then discusses adding messaging, contact, and calendar functionalities in a Web
Storage System application.
After completing this module, students will be able to:
!
Describe the various versions of CDO available with Windows 2000 and
Exchange 2000.
!
Describe the CDO architecture and how it is possible to use the architecture
to incorporate CDO into a Web Storage System solution.
!
Identify the components of the CDO for Exchange object model, and
describe how to use them to develop a Web solution.
!
Add the messaging functionality in a Web application by using the CDO
Message object.
!
Add contact functionality in a Web application by using the CDO Person
object.
!
Add calendar functionality in a Web application by using the Appointment
and CalendarMessage objects.
!
Perform Exchange 2000 administration tasks by using CDO for Exchange
Management.

In Lab A, Incorporating CDO for Exchange into a Web Solution, students will

retrieve a message by using ActiveX
®
Data Objects (ADO) and then use CDO
for Exchange to send the message, create a meeting, and attach supporting
information and links to the meeting item by using collaborative objects.
In Lab B, Performing Basic Exchange 2000 Administrative Tasks by Using
CDO for Exchange Management, students will create a new public folder,
create a new mailbox, and use CDO for Exchange Management objects to build
and mount a new information store.
Presentation:
170 Minutes

Labs:
60 Minutes
iv Module 4: Incorporating CDO for Exchange 2000 into a Web Solution


Materials and Preparation
This section provides the materials and preparation tasks that you need to teach
this module.
Required Materials
To teach this module, you need the following materials:
!
Microsoft PowerPoint
®
file 2019A_04.ppt
!
Module 4, “Incorporating CDO for Exchange 2000 into a Web Solution”

Preparation Tasks

To prepare for this module, you should:
!
Read all of the materials for this module.
!
Complete the labs.
!
Review the section on CDO in the Exchange 2000 Server Software
Development Kit (SDK).

Module 4: Incorporating CDO for Exchange 2000 into a Web Solution v


Module Strategy
Use the following strategy to present this module:
!
Introduction to CDO
Present a brief overview of CDO. Discuss the various versions of CDO.
Emphasize that whereas previous versions of CDO, such as CDO versions
1.1, 1.2, and 1.2.1, relied on MAPI as the data access and transport format,
CDO for Windows 2000 and CDO for Exchange are based on Internet-
defined standards.
!
CDO Architecture
Describe the CDO architecture and how it provides access to the Web
Storage System and the Active Directory

directory service.
!
The CDO for Exchange Object Model
Describe the components of the CDO for Exchange object model. Describe

the Configuration object and the IDataSource interface, and explain the
purpose of each. Emphasize that each top-level CDO object stores a
reference to a central Configuration object through a Configuration
property on an associated interface. Explain that all top-level CDO objects
expose an implementation of the IDataSource interface.
!
Adding Messaging Functionality
Describe the Message object. Emphasize that before sending a message, it is
a good practice to resolve each recipient address to avoid getting
undeliverable messages. Explain how Exchange 2000 resolves a recipient’s
address. Next, demonstrate how to create and send a message by using the
Message object and the Addressee object. Lastly, show how to modify the
Multipurpose Internet Mail Extensions (MIME) content in a message.
!
Adding Contact Functionality
Describe the Person object and show how to create contacts by using this
object. Next, show how to search and display contacts in Exchange 2000 by
using CDO and ADO. Explain that Exchange 2000 supports the Internet
industry vCard standard for obtaining contact information through the CDO
Person object. Lastly, show how to export and import contact information
by using the vCard format.
vi Module 4: Incorporating CDO for Exchange 2000 into a Web Solution


!
Adding Calendar Functionality
Start this section by explaining that calendar functions in Exchange 2000
can be used to create single or recurring appointments, meeting requests,
and personal and group scheduling. Next, describe the Appointment object.
Explain what a recurring appointment is and describe the steps to create it.

In the next topic, show how to schedule a meeting request by using the
Appointment and CalendarMessage objects. Show how to add attendees
to an appointment and send a meeting request to the specified users. Next,
explain how time zones work in Exchange 2000 and how to use the
Configuration object to manipulate them. Explain that before sending a
meeting request, it is possible check an attendee’s calendar to see when the
attendee is available. Show how to retrieve an attendee’s free/busy status by
using the GetFreeBusy method of the Addressee object. In the last topic,
explain that for recurring appointments, the Web Storage System stores a
single instance of the appointment. Recurring appointments are expanded
into individual instances when the Calendar folder is queried in the Web
Storage System. Outline the steps for querying and modifying recurring
appointments.
!
Administering Exchange 2000 by Using CDO for Exchange Management
In the last section of this module, discuss some applications that can be
developed by using CDO for Exchange Management. Next, discuss the
COM classes of CDO for Exchange Management model used to
programmatically administer Exchange 2000. Lastly, show how to use each
CDOEXM object to enumerate storage groups, public and private stores in
the storage groups, and the folder trees.

Module 4: Incorporating CDO for Exchange 2000 into a Web Solution 1


Overview
!
Introduction to CDO
!
CDO Architecture

!
The CDO for Exchange Object Model
!
Adding Messaging Functionality
!
Adding Contact Functionality
!
Adding Calendar Functionality
!
Administering Exchange 2000 by Using CDO for
Exchange Management


You can access items in the Microsoft
®
Web Storage System by using many
protocols and application programming interfaces (APIs).

Collaboration Data
Objects (CDO) is an API that consists of a powerful set of Component Object
Model (COM) components that you can use to manage folders, messages,
Microsoft Exchange 2000 Server mailboxes, public stores and public folder
hierarchies, appointments, contacts, and all other items in the Web Storage
System.
After completing this module, you will be able to:
!
Describe the various versions of CDO available with Microsoft
Windows
®
2000 and Exchange 2000.

!
Describe the CDO architecture and how you can use the architecture to
incorporate CDO into a Web Storage System solution.
!
Identify the components of the CDO for Exchange 2000 Server object
model, and describe how to use them to develop a Web solution.
!
Add the messaging functionality in a Web application by using the CDO
Message object.
!
Add contact functionality in a Web application by using the CDO Person
object.
!
Add calendar functionality in a Web application by using the Appointment
and CalendarMessage objects.
!
Perform Exchange 2000 administration tasks by using CDO for Exchange
Management.

Topic Objective
To provide an overview of
the module topics
and objectives.
Lead-in
In this module, you will learn
about CDO for Exchange
and how to use CDO to
create collaborative
solutions based on the Web
Storage System.

2 Module 4: Incorporating CDO for Exchange 2000 into a Web Solution


#
##
#

Introduction to CDO
!
Overview of CDO
!
Implementations of CDO


CDO is a tool with which to easily develop collaborative solutions based on the
Web Storage System. This is possible because CDO has a library of objects to
create and manage collaborative data, such as Internet messages, appointments,
contacts, and public folders.
With the exception of CDO for Microsoft Windows NT
®
,

previous versions of
CDO, such as CDO versions 1.1, 1.2, and 1.2.1, relied heavily on MAPI as the
data access and transport format. CDO for Windows 2000 and CDO for
Exchange are based on Internet-defined standards, such as Simple Mail
Transfer Protocol (SMTP) and Network News Transport Protocol (NNTP), and
use standardized data-access formats, such as OLE DB and ActiveX
®
Data

Objects (ADO). By using CDO, you can build complete messaging, calendar,
and contact management applications that run on Windows 2000 and
Exchange 2000.
Topic Objective
To introduce the topics in
this section.
Lead-in
Use the latest version of
CDO to build complete
messaging, calendar, and
contact management
applications running on
Windows 2000 and
Exchange 2000.
Module 4: Incorporating CDO for Exchange 2000 into a Web Solution 3


Overview of CDO
CDO Is Used for
$
Creating and sending bulk e-mail messages
$
Appending disclaimers or other notices to e-mail
messages sent through Exchange
$
Creating personal appointments and group schedules
$
Creating and sending meeting requests to attendees
$
Exporting and importing contact information using the

vCard format directly into the Web Storage System or
Active Directory


CDO has built-in business logic that you can use to easily access Web Storage
System data to create collaborative Web solutions. CDO recognizes
standardized Internet content types, such as Multipurpose Internet Mail
Extensions (MIME), MIME Encapsulation of Aggregate Hypertext Transfer
Protocol Documents (MHTML), vCard, and ICalendar.
Some of the solutions, or applications, that you can develop by using
CDO include:
!
Creating and sending bulk e-mail messages.

!
Appending disclaimers or other notices to e-mail messages sent through
Exchange 2000.
!
Creating personal appointments and group schedules.
!
Creating and sending meeting requests to attendees.
!
Exporting and importing contact information by using the vCard format
directly into the Web Storage System or the Active Directory


directory service.

You can also create collaborative Web solutions based on the Web Storage
System and Active Directory by using CDO in conjunction with ADO version

2.5 and Active Directory Services Interfaces (ADSI) components. ADO and
ADSI provide access to the Web Storage System and Active Directory,
respectively.
Topic Objective
To provide an overview
of CDO.
Lead-in
CDO is an API with built-in
business logic that
developers can use to easily
create complex collaborative
applications.
Discuss how CDO has built-
in business logic and
supports standardized
Internet content (such as
MIME, vCARD, and
iCalendar). Describe some
of the applications that can
be developed by
using CDO.

Explain that a vCard is a
standardized Internet
content type used to
describe attributes of
people (contacts).
4 Module 4: Incorporating CDO for Exchange 2000 into a Web Solution



Implementations of CDO
!
CDO for Windows 2000
$
Builds bulk mailing, transport protocol event sinks, and
Web-based messaging applications
!
CDO for Exchange 2000 Server
$
Builds powerful Outlook-style collaboration applications
using the Web Storage System
!
CDO Workflow Objects
$
Creates process definitions and action tables that model
your application's workflow processes
!
CDO for Exchange Management
$
Administers Exchange mailboxes and servers


Different versions of CDO are available with the installation of Windows 2000
and Exchange 2000.
CDO for Windows 2000
CDO for Windows 2000 (Cdosys.dll) has an object model that you can use to
develop messaging applications on Windows 2000. CDO for Windows 2000 is
based on the SMTP and NNTP standards and is available as a system
component with Microsoft Windows 2000 Server installations. It is the standard
API that you can use for building bulk mailing, transport protocol event sinks,

and Web-based messaging applications on Windows 2000 Server.
CDO for Windows 2000 provides enhanced functionality as compared to the
current CDO for Windows NT Server library, which is available through
Windows NT version 4.0 Option Pack 1. Although CDO for Windows 2000
provides the same functionality as CDO for Microsoft Windows NT Server,
with some additional features, it is important to modify any code written for
CDO for Windows NT Server for it to work with CDO for Windows 2000.
CDO for Exchange
CDO for Exchange (Cdoex.dll) is installed with Exchange 2000. CDO for
Exchange upgrades the registration for CDO for Windows 2000 to CDO for
Exchange. Applications based on CDO for Windows 2000 remain intact
because CDO for Exchange includes full functionality of CDO for
Windows 2000.
CDO for Exchange uses Internet standards and OLE DB data access to obtain
and manipulate data in the Web Storage System, but is not based solely on the
MAPI protocol, as was the previous version of CDO. When CDO for
Exchange is installed, all of the existing CDO 1.2 and MAPI applications will
port to Exchange 2000 and will work concurrently with applications based on
CDO for Exchange.
Topic Objective
To describe the versions
of CDO.
Lead-in
Various versions of CDO
are available with the
installation of Windows 2000
and Exchange 2000.
The previous version of
CDO (1.2.1), available with
Exchange 5.5 has been

completely remodeled and
is no longer dependent on
the MAPI protocol.

Discuss each current
version of CDO. Explain
how CDO for Windows 2000
and CDO for Exchange
relate to previous versions
of CDO. Discuss CDO
Workflow Objects and CDO
for Exchange Management
giving examples of each.
Module 4: Incorporating CDO for Exchange 2000 into a Web Solution 5


CDO for Exchange expands the functionality of the CDO for Windows 2000
messaging components to include objects for calendar and contact management.
Thus you can build powerful Web applications in the style of Microsoft
Outlook
®
2000 by using the Web Storage System. CDO for Exchange is a
server-based object model that can be used only on a computer running
Exchange 2000.
CDO WorkFlow Objects
CDO Workflow Objects for Exchange 2000 Server provides the tools you need
to add workflow to applications that access data from the Web Storage System.
Driven by the Web Storage System event architecture, CDO Workflow Objects
has a built-in workflow engine and custom COM components that you can use
to model your application's workflow processes.

CDO for Exchange Management
CDO for Exchange Management (Cdoexm.dll) is installed with Exchange 2000
and consists of a set of objects for administering Exchange 2000 servers. By
using CDO for Exchange Management, you can programmatically manage
items in Exchange 2000, such as public stores, mailbox stores, folder trees, and
storage groups. You can use CDO for Exchange Management for server
applications that are typically used in Internet applications, such as automatic
registration of users, and creating and managing e-mail accounts. You can also
install CDO for Exchange Management on a client computer to enable remote
administration of Exchange 2000.
6 Module 4: Incorporating CDO for Exchange 2000 into a Web Solution


CDO Architecture
CDO
ADO 2.5
Visual Basic, Visual C++, JScript, VBScript Application
OLE DB Provider for
Exchange 2000
ADSI
DS OLE DB
Provider
Active Directory
Active Directory
Web Storage
Web Storage
System
System



The CDO architecture provides access to the Exchange 2000 Web Storage
System and Active Directory through the following components:
!
Programming interfaces
You can access CDO from any programming language that supports COM,
such as Microsoft Visual Basic
®
and Microsoft Visual C++
®
, and scripting
languages, such as Microsoft Visual Basic Scripting Edition (VBScript) and
Microsoft JScript
®
. All of these languages use the same object library.
!
ADO and OLE DB database access
CDO uses ADO version 2.5 and OLE DB to access Exchange 2000 items
(contacts, messages, and calendar) in the Web Storage System. After ADO
and OLE DB retrieve a record or recordset, CDO can bind to individual
records for easy manipulation. For example, you can use ADO to retrieve
messages in a user’s Inbox and then bind to individual messages by using
CDO to access the properties of each message.
!
ADSI
You can use CDO and ADSI objects together to create new users and
mailboxes, manage users, and contact information in Active Directory. By
using ADSI, you can also easily identify the URLs with a particular user's
mailbox folders, such as their Inbox, Calendar, Drafts, and Contacts folders.
!
DS OLE DB Provider

You can use DS OLE DB Provider that ships with ADSI for Windows 2000
to interact quickly and easily with Active Directory.
!
Internet protocols
CDO uses the Internet Message Access Protocol (IMAP4), Post Office
Protocol 3 (POP3), SMTP, NNTP, and Lightweight Directory Access
Protocol (LDAP) protocols to access resources in the Web Storage System
and Active Directory.
Topic Objective
To show the CDO
architecture.
Lead-in
CDO is layered over
Exchange 2000 and Active
Directory as shown in
the slide.
Delivery Tip
Use the illustration in the
slide to explain how to use
different languages when
communicating with CDO
objects and how CDO uses
ADSI, the DS OLE DB
Provider, and the OLE DB
Provider for Exchange to
communicate with Active
Directory and Exchange
2000. Stress how CDO can
use Internet protocols, such
as SMTP and NNTP to

interact with standardized
Internet, content such as
MIME and ICalendar.
Module 4: Incorporating CDO for Exchange 2000 into a Web Solution 7


!
Supported content
CDO supports standardized Internet content such as MIME, MHTML,
Internet standard e-mail (RFC822), Internet standard news (RFC977),
vCard, and ICalendar. CDO can bind directly to any of these content types
for manipulation. For example, CDO can bind to the MIME content of an
e-mail message and then extract or modify the properties of that content.


For more information on RFC822 and RFC977 standards, go to


Note
8 Module 4: Incorporating CDO for Exchange 2000 into a Web Solution


#
##
#

The CDO for Exchange Object Model
!
Components of the CDO for Exchange Object Model
!

The Configuration Object
!
The IDataSource Interface


You can use CDO for Exchange to manage all aspects of message creation and
modification. You can work directly with contacts, appointments, folders, and
specific items that are stored in the Web Storage System. Additionally, CDO
for Exchange has programming logic built into the object model that you can
use to create and manipulate items in the Web Storage System to create
complex applications in Exchange 2000 with minimal code.
Topic Objective
To list the topics related to
the CDO for Exchange
object model.
Lead-in
CDO for Exchange has
programming logic built into
the object model that you
can use to create complex
applications in Exchange
2000, with minimal code.
Module 4: Incorporating CDO for Exchange 2000 into a Web Solution 9


Components of the CDO for Exchange Object Model
Item
Configuration
IDataSource
Recurrence Patterns

Fields
Appointment
Configuration
IDataSource
Fields
Exceptions
Attendees
BodyParts
Fields
Message
Configuration
IDataSource
BodyParts
Messages
(DropDirectory)
Addressee
Configuration
IDataSource
Fields
CalendarParts
IDataSource
Message
Fields
CalendarMessage Person
Configuration
IDataSource
Fields
Configuration



The CDO for Exchange object model consists of the following components:
!
Configuration object. You use the Configuration object to manage the
configuration settings for all CDO objects.
!
Fields collection. You use the Fields collection to reference an ADO Fields
collection. Each Field object in the collection contains a name/value pair
that defines property values of a particular CDO object.
!
Message object. You use the Message object to create, send, respond to, and
manage message items in the Web Storage System.
!
Person object. You use the Person object to create and manage user and
contact information in the Web Storage System and Active Directory.
!
Addressee object. You use the Addressee object to resolve addresses in
Active Directory and a Contact folder in the Web Storage System. You can
also retrieve a user's free/busy status.
!
Appointment object. You use the Appointment object to create and manage
appointment items in the Web Storage System.
!
CalendarMessage object. You use the CalendarMessage object to create,
send, reply to, and manage messages in the Web Storage System that
contain calendar-related information.
!
Folder object. You use the Folder object to manage folder items in the Web
Storage System.
!
Item object. You use the Item object to access items in the Web Storage

System. The Item object is similar to an ADO Record object.

Topic Objective
To identify the components
of the CDO for Exchange
object model.
Lead-in
The components of the
CDO for Exchange object
model are Message,
Person, Addressee,
Appointment,
CalendarMessage, Folder,
and Item.
Briefly describe each object
in the CDO for Exchange
object model and discuss its
function. Point out what the
IDataSource interface and
Configuration object have
in common to lead into the
next topic.
10 Module 4: Incorporating CDO for Exchange 2000 into a Web Solution


The Configuration Object
!
Stores the Default Configuration Information for All CDO
Top-Level Objects
!

Contains Information, Such As Methods Used to Deliver
Messages, Paths to the SMTP and NNTP Servers, and a
User's Mailbox URI
!
Automatically Created with Default Information
Gathered from Exchange


The default configuration information for all CDO top-level objects is stored in
a central Configuration object. A Configuration object contains information,
such as the methods used to deliver messages, the paths to the SMTP and
NNTP servers, and the Uniform Resource Identifier (URI) of a user's mailbox.
You can associate CDO objects with a Configuration object through their
Configuration properties.
Configuration information is stored in an ADO Fields collection in the
Configuration object. Most Configuration fields reside in the
“ namespace.
When you create a Configuration object, CDO uses the default configuration
information by collecting information from Exchange. If you do not create a
Configuration object, CDO creates one each time you send or post a message.
Changing Default Configuration
You cannot permanently change the default configuration by using the
Configuration object. To change configuration information for a Message,
Contact, or Appointment object, you must modify the fields in the
Configuration object associated with each object. After the task with the object
is complete, the Configuration object is reset to its default properties.
Using a Single Configuration Object
To use a single configuration for a set of messages, you can create a new
Configuration object, modify the fields, and then reference this Configuration
object in all the intended messages.

When you send many messages, it is a good practice to create a single
Configuration object and use it with each Message object to optimize
application performance. For example, by using CDO in an Active Server
Pages (ASP) application, you can store the Configuration class instance in the
Session object, and then reuse it for each message sent during that session.
Topic Objective
To describe the
Configuration object and
its function.
Lead-in
Each top-level CDO object
stores a reference to a
central Configuration
object through a
Configuration property on
an associated interface.
Discuss how to use the
Configuration object to
change the default
information for a CDO
object. Describe some
common default settings,
such as SMTP server and
SMTP server port. Discuss
the properties listed in the
table in the student notes
and describe the code
example. Explain how to
create a Configuration
object, configure it, and then

assign it to a CDO object,
such as a message.
Module 4: Incorporating CDO for Exchange 2000 into a Web Solution 11


Configuration Object Properties
The following table lists the most frequently used properties of the
Configuration object and their associated named constants.
Configuration
property

Named constant

Description

sendusing cdoSendUsingMethod Used to specify whether to send the
message by using the local SMTP service
drop directory (cdoSendUsingPickup), over
the network using the SMTP protocol
(cdoSendUsingPort), or by using the
Exchange mail submission URI
(cdoSendUsingExchange).
postusing cdoPostUsingMethod Used to specify whether to post the
message using the local NNTP service drop
directory (cdoPostUsingPickup), over the
network using the NNTP protocol
(cdoPostUsingPort), or by using the
Exchange mail submission URI
(cdoPostUsingExchange).
smtpserver

nntpserver
cdoSMTPServer
cdoNNTPServer
Used to indicate the Domain Name System
(DNS) name of the SMTP or NNTP service
host, if messages are sent by using the
SMTP/NNTP protocols.
smtpserverport
nntpserverport
cdoSMTPServerPort
cdoNNTPServerPort
Used to indicate the TCP/IP port of the
SMTP or NNTP service, if messages are
sent using the SMTP/NNTP protocols.

12 Module 4: Incorporating CDO for Exchange 2000 into a Web Solution


Using the Configuration Object to Configure a Message
The following VBScript code creates a Configuration object, modifies the
properties of the object through the ADO Fields collection, updates the Fields
collection, and assigns the Configuration object to a Message object through
its Configuration property:
Dim objConfiguration
Set objConfiguration = CreateObject("CDO.Configuration")
Set Flds = objConfiguration.Fields
Flds(cdoSendUsingMethod) = cdoSendUsingPort
Flds(cdoSMTPServer) = "mail.contoso.msft"
Flds(cdoSMTPServerPort) = 25
Flds(cdoSendUserName) = "domain\username"

Flds(cdoSendPassword) = "password"
Flds(cdoSMTPAuthenticate) = cdoBasic
Flds(cdoSendEmailAddress) = """Someone""" & _
"<>"
Flds.Update

Dim Msg
Set Msg = CreateObject("CDO.Message")
Set Msg.Configuration = objConfiguration
' ... compose message; add attachments, etc
Msg.Send

Module 4: Incorporating CDO for Exchange 2000 into a Web Solution 13


The IDataSource Interface
!
Use the IDataSource Interface to Access Data in the
Web Storage System, ADO Objects, ADSI Objects, and
Other CDO Objects
!
All Top-Level CDO Objects Expose an Implementation
of This Interface
!
You Can Bind CDO Objects to Items in the Web Storage
System and Other Objects by Using
$
IDataSource.Open
$
IDataSource.SaveTo

$
IDataSource.SaveToContainer


The CDO object model uses the IDataSource interface to access data in other
ADO, CDO, and ADSI objects, or to access the data in the Web Storage System
and Active Directory. All top-level CDO objects (Item, Appointment,
Message, Addressee, CalendarMessage, and Person) expose an
implementation of this interface. You can bind (associate or link two objects at
run time) CDO objects to Web Storage System items, ADO objects, ADSI
objects, and other CDO objects by using the methods of the
IDataSource interface.
When you use CDO to create an item in the Web Storage System or Active
Directory, you create a CDO object, modify its properties or streams, and then
bind the object to a new URL, or an existing URL to store the item in the Web
Storage System. To manipulate an existing item in the Web Storage System,
you create a CDO object, bind it to an existing URL, change properties on the
CDO object, and then save the changes back to the URL.
You can bind CDO objects to items in the Web Storage System by using the
following methods:
!
IDataSource.Open
The Open method first binds the specified store item, which is identified by
a URL, and then copies the data to the CDO object.
!
IDataSource.SaveTo
The SaveTo method first binds the item and then saves the current data
stored in the CDO object to the store item.
!
IDataSource.SaveToContainer

The SaveToContainer method is similar to SaveTo, except that you only
need to specify the folder in which to save the item. If you do not specify an
actual name for the item you are saving to a folder using this method, a
globally unique identifier (GUID) is generated internally to identify the
item.

Topic Objective
To describe the
IDataSource interface and
its function.
Lead-in
All top-level CDO objects
expose an implementation
of the IDataSource
interface, which is used to
access data in other ADO,
CDO, and ADSI objects, or
is used as saved data in the
Web Storage System and
Active Directory.
Discuss how the
IDataSource interface
provides all CDO objects
with access to data from a
variety of sources. Discuss
the SaveTo and
SaveToContainer methods
and explain the difference
between the two.
14 Module 4: Incorporating CDO for Exchange 2000 into a Web Solution



#
##
#

Adding Messaging Functionality
!
The Message Object
!
Resolving a Recipient's Address
!
Creating and Sending a Message
!
Accessing and Manipulating the MIME Content


Exchange 2000 provides a powerful messaging operating environment for users
to send and receive e-mail messages by supporting a variety of protocols,
including Hypertext Transfer Protocol and Web Distributed Authoring and
Versioning (HTTP/WebDAV), Microsoft OLE DB Provider for Exchange 2000
Server, SMTP, NNTP, IMAP4, and MAPI.
The CDO for Exchange component provides a set of COM classes that you can
use in your application to create, access, modify, and send messages in
standardized Internet content, such as MIME, vCard, and ICalendar.
Topic Objective
To list the topics related to
adding messaging
functionality.
Lead-in

CDO for Exchange provides
a set of COM classes that
you can use in your
application to create,
access, modify, and send
messages in standardized
Internet content.
Module 4: Incorporating CDO for Exchange 2000 into a Web Solution 15


The Message Object
!
Use the IMessage Interface of the Message Object to
Address a Message, Add Content, Send, Post, or
Respond to a Message
!
Use the IBodyPart(s) Interface of the Message Object to
Access MIME Content in a Message
!
Use the Addressee Object to Resolve Addresses for
Recipients of Messages
Message
Message


You can use the Message object's properties and methods to create and manage
messages. The primary and default interface on the Message object is the
IMessage interface. You can use this interface to access the messaging-specific
functionality of the object, including addressing the message, adding content,
and sending, posting, or responding to a message. The Message object also

supports the IBodyPart(s) interface that you can use to access the MIME
content in a message.
Messages contain a set of message headers with information, such as the
address of the message recipient and carbon copy (CC) recipients. The most
common message header fields are present as properties on the IMessage
interface, and all of these fields are accessible by using the Message object's
Fields collection.
Topic Objective
To describe the Message
object.
Lead-in
The Message object has
properties and methods with
which to create and
manage messages.
Introduce the Message
object and describe its
purpose. Discuss the
IBodyPart interface it
exposes and describe how
to use it to access the MIME
content of a message.
Discuss each property and
method listed in the tables in
student notes. Be sure to
discuss the
CreateMHTMLBODY
method.
16 Module 4: Incorporating CDO for Exchange 2000 into a Web Solution



Message Object Properties
The following table lists frequently used properties of the Message object that
you use to access its associated values.
Property Description

Attachments The collection of attachments for a message.
CC The informational (carbon copy, or Cc) recipients for a message.
Configuration The Configuration object for a message.
From The address of the message sender.
HTMLBody The HTML representation of the body of a message.
MIMEFormatted Indicates whether the message is to be formatted using MIME.
Organization A description of the organization to which the sender belongs.
ReceivedTime The date/time a message was delivered to the server.
ReplyTo The address to which the replies to a message are to be sent.
Sender The address of the sender of a message.
SentOn The date/time a message was sent to the server.

Subject The subject of a message.
TextBody The plain text representation of the body of a message.
To The recipients of the message.
BodyPart Returns the iBodyPart interface of a message object.

Message Object Methods
The following table lists the frequently used methods of the Message object.
Method Description

AddAttachment Adds an attachment to a message. The method accepts a
file, File Transfer Protocol (FTP), HTTP, or URL
parameter that identifies the location of the attachment.

Forward Creates and returns another message that can be used to
forward a message.
Post Submits a message to the specified newsgroups.
Reply Creates and returns another message that can be used to
reply to the sender of a message.
ReplyAll Creates and returns another message that can be used to
reply to the sender and all recipients.
Send Sends a message.
CreateMHTMLBODY Converts the contents of an entire Web page into
MHTML-formatted body parts on this message.

Module 4: Incorporating CDO for Exchange 2000 into a Web Solution 17


Resolving a Recipient's Address
!
Exchange Checks Each Address Against Active
Directory or a Contact Folder
!
If an Address Is Found, It Is Considered Resolved
!
If an Address Can Be Matched with More Than One
Entry, It Is Considered to Be Ambiguous


Before attempting to send a message, it is a good practice to resolve each
recipient address to avoid undeliverable messages. You can use the Addressee
object to resolve addresses for recipients of messages. When Exchange 2000
resolves an address, it checks the address against Active Directory or a Contact
folder. If the address is found in a Contact folder or Active Directory, the

address is considered resolved.
If an address can be matched with more than one entry in a Contact folder or
Active Directory, the address is considered to be ambiguous. In such a case,
you can enumerate a collection to display all the matching names.
Addressee Object Properties
The following table lists frequently used properties of the Addressee object.
Name Description

DirURL Contains the directory URL to the resolved user object in Active
Directory.
DisplayName Contains the display name of an addressee.
EmailAddress Contains the e-mail address of an addressee.
ResolvedStatus Indicates the resolution status of an addressee. Possible values
include cdoUnResolved (0), cdoResolved (1) and cdoAmbiguous
(2).

Topic Objective
To explain how
Exchange 2000 resolves a
recipient’s address.
Lead-in
Before sending a message,
it is a good practice to
resolve each recipient
address to avoid getting
undeliverable messages.
Introduce the Addressee
object and discuss how to
use it to resolve e-mail
addresses and display

names of users in Active
Directory or a Contact
folder. Discuss each
property and method listed
in the tables in the student
notes.
18 Module 4: Incorporating CDO for Exchange 2000 into a Web Solution


Addressee Object Methods
The following table lists frequently used methods of the Addressee object.
Name Description

CheckName Attempts to resolve an addressee directory object using the
information specified in the object.
GetFreeBusy Gets the free/busy information for a resolved attendee.
AmbiguousName A collection of all addressees that match the ambiguous criteria
used to resolve a particular addressee.

Module 4: Incorporating CDO for Exchange 2000 into a Web Solution 19


Creating and Sending a Message
Exchange 2000
Exchange 2000
To: ;

Team.Schedule.doc
Word
Attachment

Word
Attachment
Addressee
Addressee Send


The following VBScript code will resolve a recipient address by using the
Addressee object when you create a message and use the AddAttachment
method of the Message object to add a Graphics Interchange Format (GIF)
graphic, a Microsoft Word file, and an MHTML file as attachments to the
message.
Dim Addressee
Set Addressee = CreateObject("CDO.Addressee")
'enter the email address to resolve
Addressee.DisplayName = "paul"
'call the CheckName method, pass the name of the LDAP server
Addressee.CheckName "LDAP://Server"

'check the ResolvedStatus
Select Case Addressee.ResolvedStatus
Case 1 'cdoResolved
Dim Msg
Set Msg = CreateObject("CDO.Message")
With Msg
.To = ""
.From = ""
.Subject = "Agenda for staff meeting"
.CreateMHTMLBody _
"t/staffmeet.htm"
.AddAttachment "file://c:/companydocs/TeamSchedule.doc"

.AddAttachment "t/Docs/logo.gif"
.Send
.Newsgroups = "contoso.public.newsgroup1"
.Post
End With
(code continued on following page)
Topic Objective
To show how to create and
send a message by using
the Message object.
Lead-in
The following VBScript code
shows how to send an e-
mail message with
attachments and how to
resolve a recipient’s address
by using the Addressee
object.
Delivery Tip
Scroll through each line of
code in the example and
explain each property and
method as it is used.

×