用ASP读取EXCHANGE2000中的邮件属性-已读或未读

sub ShowMailList(oXmlDom,szOrder,szAscDesc,szClass)
 dim szSubject
 dim szFrom
 dim szFromName
 dim szFromEmail
 dim szSize
 dim dtDatereceived
 dim nImportance
 dim boolRead
 dim szHref
 dim szMsgUrl
 dim boolHasattachment
 dim szOutlookmessageclass
 dim bSaveTempFlag

 dim nOddCount  '奇、偶计数
 nOddCount=1
 
 dim oNodePropstat
 dim oNodeProp
 dim oNode
 dim szFlagOrder
 dim szNextAscDesc
 if szAscDesc="ASC" then
  szFlagOrder="<SPAN style=""font:10pt Webdings"">5</SPAN>"
  szNextAscDesc="DESC"
 else
  szFlagOrder="<SPAN style=""font:10pt Webdings"">6</SPAN>"
  szNextAscDesc="ASC"
 end if
 if m_szSearch<>"" then
  Response.Write "<font style=""font-size:9pt"">查询'" & m_szSearch & "'结果</font>"
 end if
'***************开始输出表头 ****************** 
  Response.Write "<TABLE id=ta width=100% border=0 cellspacing=1 cellpadding=0>"
  Response.Write "<TH width=1% TITLE=""全部选中/全部取消""><input type=checkbox id=chkSel οnclick=""SelectAll()""></input></TH>"

  if szOrder="importance" then
   Response.Write "<TH width=1% TITLE=重要性(点击将排序) id=importance  order=" & szNextAscDesc & " οnclick=ReOrder() style=""cursor:hand""><IMG src=""Img/mark.GIF"">" &  szFlagOrder & "</TH>"
  else
   Response.Write "<TH width=1% TITLE=重要性(点击将排序) id=importance order=DESC οnclick=ReOrder() style=""cursor:hand""><IMG  src=""Img/mark.GIF""></TH>"
  end if

  if szOrder="hasattachment" then
   Response.Write "<TH width=1%  TITLE=是否有附件(点击将排序) id=hasattachment  order=" & szNextAscDesc & " οnclick=ReOrder() style=""cursor:hand""><IMG src=img/attachwhite.gif width=10 heignt=14>" &  szFlagOrder & "</TH>"
  else
   Response.Write "<TH width=1%  TITLE=是否有附件(点击将排序) id=hasattachment  order=DESC οnclick=ReOrder() style=""cursor:hand""><IMG src=img/attachwhite.gif width=10 heignt=14></TH>"
  end if
 
  if szOrder="subject" then
   Response.Write "<TH width=35%  TITLE=主题(点击将排序) id=subject  order=" & szNextAscDesc & " οnclick=ReOrder() style=""cursor:hand"">主题" &  szFlagOrder & "</TH>"
  else
   Response.Write "<TH width=35%  TITLE=主题(点击将排序) id=subject order=DESC οnclick=ReOrder() style=""cursor:hand"">主题</TH>"
  end if
 
  if (m_szOldFolderName = "已发送邮件") then
   if szOrder="to" then
    Response.Write "<TH width=20%  TITLE=收件人(点击将排序) id=to  order=" & szNextAscDesc & " οnclick=ReOrder() style=""cursor:hand"">收件人" &  szFlagOrder & "</TH>"
   else
    Response.Write "<TH width=20%  TITLE=收件人(点击将排序) id=to order=DESC οnclick=ReOrder() style=""cursor:hand"">收件人</TH>"
   end if
  else
   if szOrder="fromname" then
    Response.Write "<TH width=20%  TITLE=发件人(点击将排序) id=fromname  order=" & szNextAscDesc & " οnclick=ReOrder() style=""cursor:hand"">发件人" &  szFlagOrder & "</TH>"
   else
    Response.Write "<TH width=20%  TITLE=发件人(点击将排序) id=fromname order=DESC οnclick=ReOrder() style=""cursor:hand"">发件人</TH>"
   end if
  end if
 
  if szOrder="date" then
   Response.Write "<TH width=32%   TITLE=接收时间(点击将排序) id=date  order=" & szNextAscDesc & " οnclick=ReOrder() style=""cursor:hand"">接收时间" &  szFlagOrder & "</TH>"
  else
   Response.Write "<TH width=32%  TITLE=接收时间(点击将排序) id=date  order=DESC οnclick=ReOrder() style=""cursor:hand"">接收时间</TH>"
  end if
 
  if szOrder="size" then
   Response.Write "<TH width=10% TITLE=邮件大小(点击将排序) id=size  order=" & szNextAscDesc & " οnclick=ReOrder() style=""cursor:hand"">大小" &  szFlagOrder & "</TH>"
  else
   Response.Write "<TH width=10% TITLE=邮件大小(点击将排序) id=size order=DESC οnclick=ReOrder() style=""cursor:hand"">大小</TH>"
  end if
'***************输出表头结束 ******************

 set oNodePropstat=oXmlDom.selectNodes("//a:propstat[./a:status='HTTP/1.1 200 OK']")
 if not (oNodePropstat is nothing ) then
  dim ii
  dim nUbound
  if CInt(m_nPage)<CInt(m_nPageCount) then
   nUbound=m_nPerPageMsgs * m_nPage
  else
   nUbound=m_nTotalMsgs   
  end if
  for ii=m_nPerPageMsgs * (m_nPage-1) to nUbound-1
   set oNode=oNodePropstat.item(ii)
   if (oNode.selectSingleNode("a:status").text="HTTP/1.1 200 OK") then
    szMsgUrl=oNode.parentNode.selectSingleNode("a:href").text
    set oNodeProp=oNode.selectSingleNode("a:prop")
    
    '判断是否是暂存邮件(看是否有发件人地址)
    szFromName=GetNodeTypedValue(oNodeProp,"fromname")
    if szFromName="" then
     bSaveTempFlag=1
    else
     bSaveTempFlag=0
    end if

    szSubject=server.HTMLEncode(  GetNodeTypedValue(oNodeProp,"subject"))
    if szSubject="" then szSubject="(无主题)"
    if bSaveTempFlag=1 then
     szSubject="<B>[暂存]</B>" & szSubject
    end if
    
    if (m_szOldFolderName = "已发送邮件") then
     szFromName=GetNodeTypedValue(oNodeProp,"displayto")
     szFromEmail=GetNodeTypedValue(oNodeProp,"to")
     szFrom="<span title=""" & Server.HTMLEncode(szFromEmail) & """>" & szFromName & "</span>"
    else
     szFromName=GetNodeTypedValue(oNodeProp,"fromname")
     szFromEmail=GetNodeTypedValue(oNodeProp,"fromemail")
     if szFromEmail="" then
      szFrom=szFromName
     else
      szFrom=szFromName & "[" & szFromEmail & "]"
     end if
     szFrom="<A target=frmView TITLE=""点击将给 " & szFrom & " 发邮件"" οnclick='DoHide()' href=Mail_New.ASP?szTo=" & szFromEmail & ">" & szFromName & "</A>"
    end if
    
    szSize=GetNodeTypedValue(oNodeProp,"getcontentlength")
    szSize=FormatSize(szSize,1)
    
    dtDatereceived=GetNodeTypedValue(oNodeProp,"datereceived")
    dtDatereceived=formatUTCDate(dtDatereceived,"yyyy-mm-dd(w) hh:nn")
    
    nImportance=GetNodeTypedValue(oNodeProp,"importance")
    
    boolRead=GetNodeTypedValue(oNodeProp,"read")'此处为邮件是否已读,true为已读,false为未读
    boolHasattachment=GetNodeTypedValue(oNodeProp,"hasattachment")

    szOutlookmessageclass=GetNodeTypedValue(oNodeProp,"outlookmessageclass")
    select case szOutlookmessageclass
    case "IPM.Contact":
     szHref="Contact_Read.ASP?szMsgUrl=" & server.urlencode(szMsgUrl)
    'IPM.Note,REPORT.IPM.Note.NDR
    case else
     if bSaveTempFlag=0 then
      szHref="Mail_Read.ASP?szMsgUrl=" & server.urlencode(szMsgUrl) & "&amp;ReadId=" & boolRead
      '是否刷新页面
      dim szfreshid
      if( nImportance=2 and( not boolRead)) then
       szfreshid="yes"
      end if
      '刷新页面判断结束
     else
      szHref="Mail_New.ASP?szSendType=SaveTemp_Read&szMsgUrl=" & server.urlencode(szMsgUrl)
     end if
    end select
    
    nOddCount=(nOddCount +1) mod 2   '奇、偶行
    '开始输出列表
    Response.Write GetOddEvenTr(nOddCount,boolRead)
    Response.Write "<TD><input type=checkbox id=chkSel link=" & szMsgUrl & "></TD>"
    Response.Write GetImportantColor(nImportance)
    Response.Write GetHasattachment(boolHasattachment,szOutlookmessageclass)
    if szfreshid="yes" then
     if boolRead then
      Response.Write "<TD><A  target=frmView href=" & szHref  & " οnclick='window.location.reload(true)'>" & szSubject & "</A></TD>"
     else
      Response.Write "<TD><A  target=frmView href=" & szHref  & " οnclick='window.location.reload(true)'>" & szSubject & "</A><img src=img/newpost.gif></TD>"
     end if
    else
     if boolRead then
      Response.Write "<TD><A  target=frmView href=" & szHref  & ">" & szSubject & "</A></TD>"
     else
      Response.Write "<TD><A  target=frmView href=" & szHref  & ">" & szSubject & "</A><img src=img/newpost.gif></TD>"
     end if
    end if 
    Response.Write "<TD align=""center"">" & szFrom & "</TD>"
    Response.Write "<TD align=""center"">" & dtDatereceived & "</TD>"
    Response.Write "<TD align=right>" & szSize & "</TD>"
    Response.Write "</TR>"
    
   end if
  next
 end if
 Response.Write "</TABLE>"
 set m_oSvrXmlHttp=nothing
end sub

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值