Using ADO to Retrieve XML Data from Exchange Server


You can retrieve XML data from Exchange Server in a number of other ways. One way is to generate the XML data yourself by using ADO. For example, you can generate an XML document for your data and simply plug in values for the properties from the ADO Fields collection. It's not too pretty or easy a technique, but it works.

Another way you can retrieve XML data from Exchange Server is to leverage the XML persistence feature in ADO. ADO allows you to both load and save data in an XML format. The XML format must, however, adhere to the structure expected by ADO. To save data as XML, you just call the Save method of the RecordSet object and pass in a location and adPersistXML (1) .

The cool thing about using ADO with XML is that ADO can persist to the file system or directly to the ASP Response object. This means you can either save your RecordSet to an XML file or blast the data to the browser in ASP applications. You can also reload a RecordSet from a correctly formatted XML document. We'll cover that feature later when we talk about deploying the workflow portion of the Training application. The following XML document comes from the Training application data saved by ADO's XML features:

 <xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'     xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'     xmlns:rs='urn:schemas-microsoft-com:rowset'     xmlns:z='#RowsetSchema'> <s:Schema id='RowsetSchema'>    <s:ElementType name='row' content='eltOnly' rs:updatable='true'>       <s:AttributeType name='c0' rs:name='urn:schemas:mailheader:subject'          rs:number='1' rs:nullable='true' rs:write='true'>          <s:datatype dt:type='string' dt:maxLength='32768'/>         </s:AttributeType>       <s:AttributeType name='c1' rs:name='DAV:href' rs:number='2'          rs:nullable='true'>          <s:datatype dt:type='string' dt:maxLength='32768'/>       </s:AttributeType>       <s:AttributeType name='c2' rs:name='urn:schemas:calendar:dtstart'          rs:number='3' rs:nullable='true' rs:write='true'>          <s:datatype dt:type='dateTime' rs:dbtype='filetime'             dt:maxLength='16' rs:precision='19' rs:fixedlength='true'/>       </s:AttributeType>       <s:AttributeType name='c3' rs:name='urn:schemas:calendar:dtend'          rs:number='4' rs:nullable='true' rs:write='true'>          <s:datatype dt:type='dateTime' rs:dbtype='filetime'             dt:maxLength='16' rs:precision='19' rs:fixedlength='true'/>       </s:AttributeType>       <s:extends type='rs:rowbase'/>    </s:ElementType> </s:Schema> <rs:data>    <z:row c0='CDO and You' c1='file://./backofficestorage/       thomriznt5dom.extest.microsoft.com/Public Folders/140/Training/       Schedule/{75BD5A83-09E7-47B7-A9F1-A75DD62F5BA7}.EML'       c2='2000-03-08T18:00:00' c3='2000-03-08T19:00:00'/>    <z:row c0='Leveraging XML in Exchange 2000' c1=       'file://./backofficestorage/thomriznt5dom.extest.microsoft.com/          Public Folders/140/Training/Schedule/{8C35C44B-68EB-4651-AC3E-          5C475923A7A1}.EML'        c2='2000-03-08T21:00:00' c3='2000-03-08T23:00:00'/> </rs:data> </xml> 



Programming Microsoft Outlook and Microsoft Exchange 2003
Programming MicrosoftВ® OutlookВ® and Microsoft Exchange 2003, Third Edition (Pro-Developer)
ISBN: 0735614644
EAN: 2147483647
Year: 2003
Pages: 227
Authors: Thomas Rizzo

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net