Title: Using CDO And ADSI For Contact Management
1Using CDO And ADSI For Contact Management
Robert BrownProgram ManagerExchange Server
Product UnitMicrosoft Corporation
2(No Transcript)
3Agenda
- Demo - virtual community web site
- Schema for contact management
- The CDO Person Object
- Interacting with the Web Store
- Interacting with the directory
- Using ADSI to work with people and groups
- CDO for Exchange Management
4Demonstration
5Person Schema
- Exchange 5.5 and CDO 1.21
- CDO 1.2 does not have a contact object
- Outlook has a contact object but you cant use it
on the server - Store had no knowledge of structured data
- Developers had to invent schema, or figure out
the Outlook schema - No interop with other popular person schemas like
LDAP and VCard
6Person Schema
- Exchange 2000
- Knows about and exposes structured data
- Ships with a comprehensive and extensible set of
schema - Including urncontent-classesperson
- Based on LDAP
- Normalized across VCARD, Outlook Express, and
Outlook Contacts - Person schema also has built-in behaviors
7Schema Inheritance
- Subclass Exchange 2000 schema to fit your
business needs
urncontect-classesobject
(base object)
urncontent-classesitem
(basic document properties)
urncontent-classesperson
(person-specific properties)
my-customer
my-competitor
(specific to your customers)
(specific to your competitors)
8DemonstrationExchange 2000s Person schema
- urncontent-classesperson has a comprehensive
set of properties - The person schema is described using XML
- Schema is directly leveraged by in Web Forms
- Binding in native HTML no programming required!
9Programming With The Person Schema
- HTTP-DAV
- OLE DB
- ADO
- CDO.Person
10ADO - Code Sample
sDom mydom.myOU.myorg.com sMB /mbx/
useralias /contacts sURL file//./BackOffic
eStorage/ myDom sMB set rs
server.createobject("adodb.recordset") rs.Open
"select ""DAVhref"", ""urnschemascontactsfilea
s" from SCOPE('shallow traversal of " sURL
"")", "ProviderExoledb.DataSource.1 Data
Source sURL While Not rs.EOF
response.write _ rs.Fields("urnschema
scontactsfileas").Value rs.MoveNext Wend
sDom mydom.myOU.myorg.com sMB /mbx/
useralias /contacts sURL file//./BackOffic
eStorage/ myDom sMB
set rs server.createobject("adodb.recordset")
rs.Open "select ""DAVhref"", ""urnschemascontac
tsfileas" from SCOPE('shallow traversal of
" sURL "")", "ProviderExoledb.DataSourc
e.1 Data Source sURL
While Not rs.EOF response.write _
rs.Fields("urnschemascontactsfileas").Value
rs.MoveNext Wend
11CDO Person Object Model
- CDO.Person
- CDO for Exchange Management
- Extends CDO by adding two interfaces to
CDO.Person - IMailRecipient
- IMailBoxStore
12CDO.Person
- Models a Person in the contact database and in
the Directory - Provides simple access to name, addresses,
telephone numbers and email addresses properties - All other properties available through the fields
collection - Supports VCard import and export
13CDO.Person Interfaces
- IPerson
- IDataSource
- IMailbox
- IMailboxStore
- IMailRecipient
14IPerson Properties
- Name
- First, Middle, Last, Title, Initials, Suffix,
Prefix - Address Properties
- Separate sets of properties for Home, Work and
Mailing addresses - Street, city, state, country, post code, postal
address, P.O. Box
15More IPerson Properties
- E-mail addresses
- Telephone numbers
- Home and work phone,home and work fax, mobile
phone - Fields Collection
16IMailBox Properties
- URLs to exchange folders
- Inbox
- Outbox
- Contacts
- Calendar
- Etc.
17IMailBox Code Sample
Set pers server.CreateObject("CDO.Person") Set
f server.CreateObject("CDO.Folder") set rs
server.CreateObject("ADODB.Recordset")
Set pers server.CreateObject("CDO.Person") Set
f server.CreateObject("CDO.Folder") set rs
server.CreateObject("ADODB.Recordset") pers.DataS
ource.Open "mailto" uid "_at_"
dnsdomain f.DataSource.Open pers.GetInterface("IM
ailbox").Inbox rs.Open "select from
SCOPE('shallow traversal of """ m.Inbox
"""')", _ f.DataSource.ActiveConnection Whi
le Not rs.EOF response.write
rs.Fields("DAVdisplayname").Value
rs.MoveNext Wend
pers.DataSource.Open "mailto" uid "_at_"
dnsdomain
f.DataSource.Open pers.GetInterface("IMailbox").In
box
rs.Open "select from SCOPE('shallow traversal
of """ m.Inbox """')", _
f.DataSource.ActiveConnection
While Not rs.EOF response.write
rs.Fields("DAVdisplayname").Value
rs.MoveNext Wend
18Directory Integration
- Contacts can exist in
- Active Directory
- Exchange 2000 Web Store (public or private)
- Use CDO.Person to create contacts anywhere
- Use CDO Contacts to bind to a Contact in the
Directory and then save it to a contacts database
19Directory Integration Code Sample
Copy pers1 from the DS into pers2s contacts
folder
Set pers1 server.CreateObject("CDO.Person") Set
pers2 server.CreateObject("CDO.Person") pers1.D
ataSource.Open "mailto" uid1 "_at_"
domain pers2.DataSource.Open "mailto" uid2
"_at_" domain pers1.DataSource.SaveToContainer _
pers2.GetInterface("IMailbox").Conta
cts
Set pers1 server.CreateObject("CDO.Person") Set
pers2 server.CreateObject("CDO.Person")
pers1.DataSource.Open "mailto" uid1 "_at_"
domain pers2.DataSource.Open "mailto" uid2
"_at_" domain
pers1.DataSource.SaveToContainer _
pers2.GetInterface("IMailbox").Contacts
20ADSI IADs interface
- Implemented by every base object
- Properties
- Name, ADsPath, class, schema, parent
- Methods
- Get, put, getinfo, setinfo
- Using only the IADs interface you can learn all
about an object and get or set all of its
properties - Use GetObject(ADSPath)
21ADSIReading And writing properties
- Simple caching system
- IADsGetInfo()
- Reloads the cache with values from the
underlying Web Store - Changes made in the cache are lost
- IADsSetInfo()
- Writes cached changesto the underlying Web Store
22DemonstrationADSI and CDO.Person in the directory
- Use CDO.Person to interact with the Directory
- Use CDO.Person to save contacts from the DS to
the Web Store
23CDO For Exchange Management
- CDOEXM (a.k.a. EMO) extends CDO and ADSI by
adding management interfaces - Exchange 2000 release supports recipient and
folder management - Exchange 2000 includes the following management
interfaces - IMailRecipient
- IMailBoxStore
24CDO EXMObject model
- CDOEXM extends CDO
- Extends Person by adding IMailRecipient and
IMailboxStore interfaces - Extends Folder by adding IMailRecipient
interface - CDOEXM extends ADSI
- Extends User with IMailRecipient and
ImailboxStore interfaces - Extends Group and Contact with IMailRecipient
interface
25CDOEXM IMailRecipient
- Provides access to the properties of a
mail-enabled recipient in the DS - Promotes management properties
- Proxy addresses
- Send/deliver limits
- Forwarding properties
- Restricted address properties
- Common management methods
- Mail enable, mail disable
26CDOEXMIMailboxStore
- Provides access to the properties of a user with
an Exchange mailbox - Promotes management properties
- Store quotas
- Garbage collection parameters
- Mailbox location
- Delegates
- Common management methods
- Create, delete and move mailbox
27CDOEXM - Code SampleMailbox- enabling a user
Dim objUser As IADsUser Dim objMailbox As
CDOEXM.IMailboxStore Set objUser
GetObject("LDAP//exsrv1/CNuser1, OUMarketing
,DCmicrosoft,DCcom") objUser.CreateMailbox
"LDAP//exsrv1/CNPrivate MDB, CNSG1,CNInform
ationStore,CNEXMBSVR, CNServers,CNAG1, C
NAdministrative Groups,CNOrg, CNMicrosoft
Exchange,CNServices, CNConfiguration,DCmicro
soft,DCcom" objUser.SetInfo
Dim objUser As IADsUser Dim objMailbox As
CDOEXM.IMailboxStore
Set objUser GetObject("LDAP//exsrv1/CNuser1,
OUMarketing,DCmicrosoft,DCcom")
objUser.CreateMailbox "LDAP//exsrv1/CNPrivate
MDB, CNSG1,CNInformationStore,CNEXMBSVR,
CNServers,CNAG1, CNAdministrative
Groups,CNOrg, CNMicrosoft Exchange,CNService
s, CNConfiguration,DCmicrosoft,DCcom"
objUser.SetInfo
28CDOEXM ADSI vs. CDO integration
- ADSI provided for compatibility with existing DS
scripts and applications - Use ADSI if you need to manage groups / Exchange
distribution lists - CDO method preferred for collaborative
applications and scripts - Use CDO if you need to manage Exchange public
folders
29CDOEXM DemoCreating a user
- Adding subscribers to our Web site
30Call To Action
- Leverage the person schema
- Manage contacts in the Web Store
- use OLE DB/ADO and CDO.Person
- Access persons in the DS
- Use CDO.Person, ADSI, OLE DB/ADO
- Use CDO.Person for in-memory behaviors
- Leverage the person schema
- Manage contacts in the Web Store
- Use OLE DB/ADO and CDO.Person
- Access persons in the DS
- Use CDO.Person, ADSI, OLE DB/ADO
- Use CDO.Person for in-memory behaviors
31(No Transcript)