标题: 关于列举未读邮件的asp代码 [打印本页] 作者: kelvin55 时间: 2007-10-22 17:40 标题: 关于列举未读邮件的asp代码 在进行取得未读邮件的时候,我参考了exchange 2007 sdk里面的例子代码,但是里面有一些参数不是很明白是什么东西,希望获得一些指点和帮助
我的域名是contoso.com
数据库是mailbox database
主机名字是SMBEX01
请问对于如下程序的字符串部分,我改如何修改,它的例子代码都代表的什么参数啊?
==================********************************************======================
' Listing Unread Messages in a Folder Using ADO
' This ASP page loops through all of the messages in the inbox and outputs the unread messages
' in an HTML table.
<%@ Language=VBScript %>
<%
Dim Rec '记录集
Dim Rs
Dim strURL
Dim strQ 'strQuest? ?
Dim strSubj
Dim DomainName
Dim strLocalPath
Dim UnreadCount
Set Rec = CreateObject("ADODB.Record")
Set Rs = CreateObject("ADODB.Recordset")
' Time can be changed for folders with more messages.
Session.Timeout = 10
' Set your own values to the following variables:
DomainName = "contoso.com"
UserID ="peter"
PSW ="password"
'strLocalPath : 定义的形式:例子中MBX的属性是什么? inbox的属性是什么?
strLocalPath = "MBX/" & UserID & "/inbox"
'strURL中的属性定义 : 该如何改写此URL?
strURL = "file://./backofficestorage/" & DomainName & "/" & strLocalPath
Response.Write "strURL= " & strURL
Rec.Open strURL,,,,,UserID,PSW
' Build the SQL query for the messages.
strQ = "select "
strQ = strQ & " ""urn:schemas:mailheader:date"""
strQ = strQ & ", ""urn:schemas:httpmail:to"""
strQ = strQ & ", ""urn:schemas:httpmail:from"""
strQ = strQ & ", ""urn:schemas:mailheader:subject"""
strQ = strQ & ", ""urn:schemas:mailheader:received"""
strQ = strQ & ", ""urn:schemas:httpmail:read"""
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:read"" = false"
' Open the recordset.
Rs.Open strQ, Rec.ActiveConnection
Rs.MoveFirst
Unreadcount = 0
' Loop through all of the messages in the recordset and format them in a table.
Do Until Rs.EOF
Response.Write "<TABLE BORDER=2 cellpadding=2 cellspacing=2 width='100%'><TR>"
Response.Write "<tr><td><b>From: </b></td>"
Response.Write "<td>" & Rs.Fields("urn:schemas:httpmail:from").Value & "</td></tr>"
Response.Write "<tr><td><b>To: </b></td>"
Response.Write "<td>" & Rs.Fields("urn:schemas:httpmail:to").Value & "</td></tr>"
Response.Write "<tr><td><b>Subject: </b></td>"
Response.Write "<td>" & Rs.Fields("urn:schemas:mailheader:subject").Value & "</td></tr>"
Response.Write "<tr><td><b>Date Sent: </b></td>"
Response.Write "<td>" & Rs.Fields("urn:schemas:mailheader:date").Value & "</td></tr>"
Response.Write "<tr><td><b>Date Received: </b></td>"
Response.Write "<td>" & Rs.Fields("urn:schemas:mailheader:date").Value & "</td></tr>"
Response.Write "<tr><td><b>Content-Class: </b></td>"
Response.Write "<td>" & Rs.Fields("DAV:contentclass").Value & "</td></tr>"
Response.Write "<tr><td><b>URL: </b></td>"
Response.Write "<td>" & Rs.Fields("DAV:href").Value & "</td></tr>"
Response.Write "</p>"
unreadcount = unreadcount + 1
Rs.MoveNext
Response.Write "<tr><td height=10></tr></td><tr><td height=10></tr></td>"
Response.Write "</TABLE><br>"
Loop
' Close the record and recordset.
Rs.Close
Rec.Close
Response.Write "<hr size=5><b>Total unread messages: </b>" & unreadcount