Platform SDK: Exchange 2000 Server

Character Matching using LIKE

[This is preliminary documentation and subject to change.]

The LIKE operator performs character matching on a specified string. The percent character, %, matches any or no characters adjacent to the specified string. For example, "%he ca%" matches "the cat."

This example search a folder’s items whose urn:schemas:mailheader:from property contains a specified name.

[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 = "bruceham2dom.extest.microsoft.com"
strLocalPath = "public folders/disc"

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

strQ = "select "
strQ = strQ & " ""DAV:displayname"""
strQ = strQ & " from scope ('shallow traversal of "
strQ = strQ & Chr(34) & strURL & Chr(34) & "') "

'specify a string for LIKE, this example uses Savage
strQ = strQ & "WHERE ""DAV:displayname"" LIKE '%Savage%'"

Rs.Open strQ, Rec.ActiveConnection

Rs.MoveFirst

Do Until Rs.EOF
   Response.Write "<b>Subject:</b><br>"
   Response.Write Rs.Fields("DAV:displayname").Value & "<br>"
   Response.Write "</p>"
   Rs.MoveNext
Loop


Rs.Close
Rec.Close