Tài liệu Module 3: Accessing Exchange 2000 Data by Using ADO 2.5 doc

54 493 0
Tài liệu Module 3: Accessing Exchange 2000 Data by Using ADO 2.5 doc

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Module 3: Accessing Exchange 2000 Data by Using ADO 2.5 Contents Overview Examining the Universal Data Access Strategy Using ADO 2.5 to Access Exchange 2000 Data Building URLs to Access Resources 15 Using SQL Queries to Access Exchange 2000 Data 21 Lab A: Accessing Exchange 2000 Data Using ADO 36 Review 49 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 3: Accessing Exchange 2000 Data by Using ADO 2.5 Instructor Notes Presentation: 90 Minutes Lab: 55 Minutes This module provides students with the information and describes the skills necessary to use ActiveX® Data Objects (ADO) version 2.5, Structured Query Language (SQL) queries, and URLs to access Microsoft® Exchange 2000 Server data and resources After completing this module, students will be able to: ! Explain the concept of Microsoft Universal Data Access strategy ! Access data in Exchange 2000 by using the Connection, Recordset, Record, and Stream objects ! Access resources in Exchange 2000 by using the File: and HTTP: schemes and URLs ! Implement data searches in Exchange 2000 by using SQL statements 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_03.ppt ! Module 3, "Accessing Exchange 2000 Data by Using ADO 2.5" Preparation Tasks To prepare for this module, you should: ! Read all of the materials for this module ! Complete the lab ! Read the Exchange 2000 Server Software Development Kit (SDK) material related to ADO iii iv Module 3: Accessing Exchange 2000 Data by Using ADO 2.5 Module Strategy Use the following strategy to present this module: ! Examining the Universal Data Access Strategy Define Universal Data Access, and introduce open database connectivity (ODBC), Remote Data Objects (RDO), Data Access Objects (DAO), and the Microsoft Data Access Components (MDAC) that implement the Universal Data Access strategy: OLE DB, ADO, RDS, and ODBC At a very high level, describe the interaction of OLE DB, ADO, and ODBC ! Using ADO 2.5 to Access Exchange 2000 Data Present the standard and new ADO 2.5 objects, with emphasis on the Record and Stream objects Use the code sample provided in Persisting a Recordset to discuss how to save a Recordset as an Extensible Markup Language (XML) file Discuss how to use the Record object to perform record manipulation tasks, such as creating files and folders, and copying, moving, and deleting resources Explain how to use the GetChildren method to access a user’s mailbox, Contacts folder, and contacts by using the illustration in Using the GetChildren Method to Navigate Web Storage System Data Explain how to use the Stream object to perform read/write operations on files ! Building URLs to Access Resources Explain how to use the File: and HTTP: schemes to access a resource Using the code samples provided in Using the File: and HTTP: Schemes, explain how to use the schemes to access public stores and mailbox stores Explain the benefits of using HTTP: scheme over the File: scheme Introduce relative URLs and explain how to use relative URLs to move through the hierarchical structure of the Web Storage System ! Using SQL Queries to Access Exchange 2000 Data Present the SQL queries that are used to access Exchange 2000 data, including the SCOPE SQL element, the WHERE clause, token formats, and WHERE clause predicates Module 3: Accessing Exchange 2000 Data by Using ADO 2.5 Overview Topic Objective To provide an overview of the module topics and objectives ! Examining the Universal Data Access Strategy Lead-in ! Using ADO 2.5 to Access Exchange 2000 Data ! Building URLs to Access Resources ! Using SQL Queries to Access Exchange 2000 Data In this module, you will learn about the Universal Data Access strategy and how it uses ADO 2.5 to access data in Exchange 2000 You will also learn how to use URLs, and SQL queries to gain access to Exchange 2000 data Microsoft® Exchange 2000 Server offers a host of database features that you can take advantage of by using OLE DB and ActiveX® Data Objects (ADO) version 2.5 Microsoft Universal Data Access strategy facilitates the use of the OLE DB Provider for Exchange 2000 Server, which makes data in Exchange 2000 available to a collaborative application You can write Structured Query Language (SQL) statements to query the properties of resources in Exchange 2000 that are similar to queries that access relational databases In addition, you can use content indexing to search the content of standard text files and binary files, such as Microsoft Word documents that are stored in Exchange 2000 After completing this module, you will be able to: ! Explain the concept of Universal Data Access strategy ! Access data in Exchange 2000 by using the Connection, Recordset, Record, and Stream objects in ADO 2.5 ! Access resources in Exchange 2000 by using the File: and HTTP: schemes and relative URLs ! Implement data searches in Exchange 2000 by using SQL statements Module 3: Accessing Exchange 2000 Data by Using ADO 2.5 Examining the Universal Data Access Strategy Topic Objective Application Browser To present the Universal Data Access strategy Lead-in ADO The Universal Data Access strategy uses Microsoft Data Access Components (MDAC) to access data These components include OLE DB, ADO, RDS, and ODBC OLE DB ODBC Relational Relational Data Data Explain the concept of Universal Data Access and describe how developers can use it to access a wide range of data sources using a common API Explain how the layers in the slide work together SQL SQL Server Server Oracle Oracle Jet Jet Other Other FoxPro FoxPro Hierarchical Hierarchical Data Data Mail Mail Video Video Directory Directory Services Text Other Services Text Other Mainframe Mainframe and and Legacy Legacy Data Data Universal Data Access is an operating environment, application, and tools strategy for integrating diverse data sources (including relational and hierarchical data sources) across an organization Support for Diverse Database Products The components of the Universal Data Access strategy are tool- and languageindependent These components not require commitment to a single vendor’s products, and they extend the functionality of well-known and welltested technologies including open database connectivity (ODBC), Remote Data Objects (RDO), and Data Access Objects (DAO) Universal Data Access support for open industry specifications means that you can provide solutions by using the tools, applications, and operating environment services of your choice Microsoft Data Access Components (MDAC) enables Universal Data Access The MDAC components include OLE DB, ADO, ODBC, and Remote Data Service (RDS, formerly known as Advanced Database Connector, or ADC) Note For more information about the current release of MDAC, you can view the online documentation at http://www.microsoft.com/data/doc.htm Interaction of OLE DB, ADO, and ODBC OLE DB is a system-level programming interface to data across an organization ADO is an application programming interface (API) to OLE DB data OLE DB builds on the success of ODBC by providing an open standard for accessing all types of data Whereas ODBC was created to access relational databases, OLE DB is designed for relational and hierarchical information sources, including Microsoft SQL Server™, Oracle, mainframe ISAM/VSAM (indexed sequential access method/virtual storage access method) and hierarchical databases; e-mail and file system stores; text, graphical, and geographical data; and custom business objects Module 3: Accessing Exchange 2000 Data by Using ADO 2.5 # Using ADO 2.5 to Access Exchange 2000 Data Topic Objective To list the topics related to using ADO 2.5 to access Exchange 2000 data ! Standard ADO 2.5 Objects Lead-in ! Persisting a Recordset ! New ADO 2.5 Objects ! Creating, Copying, and Deleting Resources Using the Record Object ! Using the GetChildren Method to Navigate Web Storage System Data ! Using the Stream Object In this section, you will learn how to use ADO 2.5 objects to access data in Exchange 2000 Although Microsoft Exchange version 5.5 is an effective store for mass hierarchical data, developing applications for Exchange 5.5 requires the use of either Collaboration Data Objects (CDO) version 1.2.1 or the Microsoft Outlook® object model With the inclusion of the Web Storage System, Exchange 2000 excels at mass storage, but now blends the Universal Data Access strategy with the exposure to an OLE DB interface that can be accessed by using ADO version 2.5 You can use the OLE DB Provider for Exchange on the local server to access Web Storage System items by using OLE DB, ADO 2.5, and CDO The new ADO 2.5 Record and Stream objects facilitate access to hierarchical data in the Web Storage System Module 3: Accessing Exchange 2000 Data by Using ADO 2.5 Standard ADO 2.5 Objects Topic Objective To present the objects that are standard to ADO ! $ Lead-in The objects that are standard in all versions of ADO include the Connection and Recordset objects Explain how to set the Provider property of a Connection object to access data in Exchange 2000 Mention that many of the methods and their parameters are used in the same way as they would be used to access relational databases with ADO 2.1 Discuss the security limitations of the Connection object with Exchange 2000 and briefly mention how to implement security by using COM+ applications Connection Object ! Use to perform data operations Recordset Object $ Use to issue SQL SELECT statements Set Set conn conn == CreateObject("ADODB.Connection") CreateObject("ADODB.Connection") conn.Provider conn.Provider == "ExOLEDB.DataSource" "ExOLEDB.DataSource" conn.Open conn.Open "http://servername/exchange/administrator/" "http://servername/exchange/administrator/" Set Set rs rs == CreateObject("ADODB.Recordset") CreateObject("ADODB.Recordset") strSQL strSQL == "SELECT "SELECT ""urn:schemas:mailheader:subject"" ""urn:schemas:mailheader:subject"" FROM" FROM" && """http://servername/exchange/User1/inbox/""" """http://servername/exchange/User1/inbox/""" && "WHERE "WHERE ""DAV:ishidden"" ""DAV:ishidden"" == FALSE" FALSE" rs.Open rs.Open strSQL, strSQL, conn conn You can use the following ADO 2.5 objects to create applications that access and modify data in the Web Storage System Connection Object Use the ADO Connection object to bind to a particular public or mailbox store, manage grouped operations, and share across Record and Recordset objects to avoid continually rebinding to stores When using the ADO Connection object to access data in Exchange 2000, you must use OLE DB Provider for Exchange by setting the Provider property to ExOLDB.DataSource For example, the following code example groups a set of data operations in Exchange 2000 in the context of an OLE DB transaction: Set conn = CreateObject("ADODB.Connection") conn.Provider = "ExOLEDB.DataSource" conn.Open "http://servername/public/" conn.BeginTrans 'perform data operations conn.CommitTrans For best server-side performance, place Connection object references in ASP Session or Application objects and reuse this connection from Active Server Pages (ASP) Module 3: Accessing Exchange 2000 Data by Using ADO 2.5 Recordset Object The Recordset object represents the result of an executed command, usually a set of records returned from a database query You can navigate through a recordset by using methods such as MoveNext and MovePrevious You can use the RecordCount property to determine the number of records in a recordset In addition, you can use the BOF (Beginning of File) and EOF (End of File) properties to determine if the current record position is at the beginning or end of a recordset For example, the following code creates a recordset of all the messages in an administrator’s Inbox, prints the total number of messages in the Inbox, and then prints the subject of each message: Set conn = CreateObject("ADODB.Connection") conn.Provider = "ExOLEDB.DataSource" conn.Open "http://servername/exchange/administrator/" Set rs = CreateObject("ADODB.Recordset") strSQL = "SELECT ""urn:schemas:mailheader:subject"" FROM" & _ """http://servername/exchange/administrator/inbox/""" & _ "WHERE ""DAV:ishidden"" = FALSE" rs.Open strSQL, conn Debug.Print rs.RecordCount Do Until rs.EOF = True Debug.Print rs.Fields("urn:schemas:mailheader:subject") rs.MoveNext Loop Note ADO exposes various properties and methods through the ADO objects Although OLE DB Provider for Exchange supports most of the ADO object model functionality, it does not support features, such as impersonation by using the UserName and Password parameters available on many ADO methods, cursor type selection, record locking options, or nested transactions Module 3: Accessing Exchange 2000 Data by Using ADO 2.5 Persisting a Recordset Topic Objective To outline the process of saving an ADO recordset as an XML file ADO Recordset Lead-in You can save an ADO recordset in the ADTG format, or the open XML format Save C:\AdminisContacts.xml SQL Query Exchange 2000 Explain how you can persist a recordset as an XML file Mention that, although this is beneficial, you can often generate your own XML file by using a looping statement for more control over the structure of the XML file that is generated You can store a Recordset object in a file by using the Save method The persistently stored file may exist on a local drive, on a network server, or as a URL on a Web site Later, the file can be restored with either the Open method of the Recordset object or the Execute method of the Connection object You can store Recordset objects in the Microsoft proprietary Advanced Data TableGram (ADTG) database format or the open Extensible Markup Language (XML) format The following code saves the URL and the name of each contact in the administrator’s Contact folder as an XML file: Set conn = CreateObject("ADODB.Connection") conn.Provider = "ExOLEDB.DataSource" conn.Open "http://servername/exchange/administrator/" Set rs = CreateObject("ADODB.Recordset") strSQL = "SELECT ""DAV:href""," & _ " ""urn:schemas:contacts:cn"" FROM" & _ " ""http://servername/exchange/administrator/Contacts/""" & _ " WHERE ""DAV:ishidden"" = FALSE" rs.Open strSQL, conn rs.Save "c:\AdminsContacts.xml", adPersistXML ... in Exchange 2000 by using the File: and HTTP: schemes and relative URLs ! Implement data searches in Exchange 2000 by using SQL statements Module 3: Accessing Exchange 2000 Data by Using ADO 2.5. .. for this module ! Complete the lab ! Read the Exchange 2000 Server Software Development Kit (SDK) material related to ADO iii iv Module 3: Accessing Exchange 2000 Data by Using ADO 2.5 Module Strategy... hierarchical databases; e-mail and file system stores; text, graphical, and geographical data; and custom business objects Module 3: Accessing Exchange 2000 Data by Using ADO 2.5 # Using ADO 2.5 to

Ngày đăng: 11/12/2013, 14:15

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan