Sdílet prostřednictvím


Viewing the Calendar (ADO)

Topic Last Modified: 2009-07-27

Example

VBScript

Note

The following example uses a file URL with the Exchange OLE DB (ExOLEDB) provider. The ExOLEDB provider also supports The HTTP: URL Scheme. Using The HTTP: URL Scheme allows both client and server applications to use a single URL scheme.

<!--
'Viewing the Calendar using ADO
-->

<!--
'Steps to test this sample.

'1) Create a folder named "test" under inetpub/wwwroot.
'2) Save the above file in that folder with the mantioned name.
'3) Make the changes to the above file i.e. Change the strLocalPath and DomainName variables to reflect your mailbox and domain.
'4) Save the file.
'5) open internet service manager and browse to the "test"  folder
'6) right click and go to properties
'7) go to the "Directory Security" tab.
'8) Click on "Edit" button next to the "handshake" icon
'9) Uncheck "Anonymous Access"
'10) check the "Digest Authentication" and "Integrated windows authentication" boxes
'11) click ok
'12) click ok
'13) Load the asp in the browser.
-->



<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY >

<%

'Viewing the Calendar using WebDAV.
'Set the required permissions on Exchange 2000 Server and IIS


Dim CalendarURL
Dim ItemURL
Dim Rs
Dim Rec
Dim Conn
Dim iAppt
Dim dateStartDate
Dim Subject
Dim DomainName
Dim strLocalPath

'specify your own domain
DomainName = "mydomain.fourthcoffee.com"
'specify a URL to folder or item
strLocalPath = "MBX/User1/Calendar"

Set Rec = CreateObject("ADODB.Record")
Set Rs = CreateObject("ADODB.Recordset")

strURL = "file://./backofficestorage/" & DomainName & "/" & strLocalPath
Rec.Open strURL
Set Rs.ActiveConnection = Rec.ActiveConnection


Rs.Source = "SELECT ""DAV:href"", " & _
" ""urn:schemas:httpmail:subject"", " & _
" ""urn:schemas:calendar:dtstart"", " & _
" ""urn:schemas:calendar:dtend"" " & _
"FROM scope('shallow traversal of """ & strURL & """') "
Rs.Open
Rs.MoveFirst

%> <FONT FACE=ARIAL SIZE=2>
<br><br>
<TABLE cellspacing=0 cellpadding=4>
<tr><td>Subject:</td><td>Start:</td><td>end:</td></tr>
<%

Do Until Rs.EOF
response.write "<tr><td>"

Response.Write Rs.Fields("urn:schemas:httpmail:subject").Value
response.write "</td><td>"

Response.Write Rs.Fields("urn:schemas:calendar:dtstart").Value
response.write "</td><td>"

Response.Write Rs.Fields("urn:schemas:calendar:dtend").Value
response.write "</td><td>"

Rs.MoveNext
Loop
%>
</tr>
</table>
</BODY>
</HTML>