Platform SDK: Exchange 2000 Server

Specifying a Date Range

[This is preliminary documentation and subject to change.]

This example filters for a range of DATES in a WHERE clause using the urn:schemas:httpmail:datereceived property.

[VBScript]
Dim Rec
Dim Rs
Dim strURL
Dim strQ
Dim strSubj
Dim DomainName
Dim strLocalPath

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

'for large folders,
'you may need to increase
'script timeout
Session.Timeout = 1400

' set your own values to these variables:
DomainName = "microsoft.com"
strLocalPath = "public folders/reports"

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

strQ = "select "
strQ = strQ & " ""urn:schemas:httpmail:datereceived"""
strQ = strQ & ", ""urn:schemas:mailheader:from"""
strQ = strQ & ", ""urn:schemas:mailheader:subject"""
strQ = strQ & ", ""DAV:contentclass"""
strQ = strQ & ", ""DAV:href"""
strQ = strQ & " from scope ('shallow traversal of "
strQ = strQ & Chr(34) & strURL & Chr(34) & "') "
strQ = strQ & "WHERE ""urn:schemas:httpmail:datereceived"" > '1999-07-01' "
strQ = strQ & "AND ""urn:schemas:httpmail:datereceived"" < '1999-08-01' "



Rs.Open strQ, Rec.ActiveConnection


Rs.MoveFirst

Do Until Rs.EOF
   Response.Write "<b>From:</b><br>"
   Response.Write Rs.Fields("urn:schemas:mailheader:from").Value & "<br>"
   Response.Write "<b>Subject:</b><br>"
   Response.Write Rs.Fields("urn:schemas:mailheader:subject").Value & "<br>"
   Response.Write "<b>Date Received:</b><br>"
   Response.Write Rs.Fields("urn:schemas:httpmail:datereceived").Value & "<br>"
   Response.Write "<b>Content-Class:</b><br>"
   Response.Write Rs.Fields("DAV:contentclass").Value & "<br>"
   Response.Write "<b>URL:</b><br>"
   Response.Write Rs.Fields("DAV:href").Value & "<br>"
   Response.Write "</p>"
   Rs.MoveNext
Loop


Rs.Close
Rec.Close