Sample code for 30+ languages & platforms
Classic ASP

Transition from Imap.Sort to Imap.QueryMbx

Provides instructions for replacing deprecated Sort method calls with QueryMbx.

Chilkat Classic ASP Downloads

Classic ASP
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0

set imap = Server.CreateObject("Chilkat.Imap")

' ...
' ...

searchCriteria = "FROM bob@example.com"
bUid = 1
sortCriteria = "DATE SUBJECT"

' ------------------------------------------------------------------------
' The Sort method is deprecated:

' msgSetObj is a Chilkat.MessageSet
Set msgSetObj = imap.Sort(sortCriteria,"UTF-8",searchCriteria,bUid)
If (imap.LastMethodSuccess = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( imap.LastErrorText) & "</pre>"
    Response.End
End If

' ...
' ...

' ------------------------------------------------------------------------
' Do the equivalent using QueryMbx.
' Your application creates a new, empty MessageSet object which is passed 
' in the last argument and filled upon success.

' The following properties are used instead of function arguments.
imap.SortCriteria = "DATE SUBJECT"
imap.SearchCharset = "UTF-8"

set mset = Server.CreateObject("Chilkat.MessageSet")
success = imap.QueryMbx(searchCriteria,bUid,mset)
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( imap.LastErrorText) & "</pre>"
    Response.End
End If


%>
</body>
</html>