storm97(风暴不再)兄,有问题,急救,大家都可以帮忙,在线等待。。。

liangsiyuan 2002-11-12 04:47:18
大家好!
上次我搞定了收发邮件的项目,十分感谢csdn的兄弟,特别是storm97!
现在我的朋友也要完成类似的功能,我已经教给他了,但是他提出了一个新的问题:
如何将邮件删除后放入删除文件夹?
后台是IIS和Exchange Server.
如果各位有空,请给解答一下!
谢谢!
如果精彩,分数再加400
...全文
35 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
jsj98301 2002-11-19
  • 打赏
  • 举报
回复
使用ado可以用delete方法

Private Sub SearchDeleteObjects(strDomainName As String, strPathOfSourceFolder As String, strRestricSql As String)
Dim Rec As New ADODB.Record
Dim Rst As New ADODB.Recordset
Dim strSourceFolderUrl As String

' set the URL to the location of the folder under which the objects are searched
strSourceFolderUrl = "file://./backofficestorage/" & _
strDomainName & "/" & strPathOfSourceFolder

' open the record
Rec.Open strSourceFolderUrl, , adModeReadWrite 'delete needs parameter adModeReadWrite

' open the recordset - a list of items
Rst.Open strRestricSql, Rec.ActiveConnection

Rst.MoveFirst
Do While Not Rst.EOF

Dim strItemUrl As String
Dim strContentClass As String

' retrieve some propertied
strItemUrl = Rst.Fields("DAV:href")
strContentClass = Rst.Fields("urn:schemas:mailheader:content-class")

'MsgBox Rst.Fields("DAV:displayname")

Rst.Delete 1

' here may make further restriction to the objects to be deleted.
' For example if searched under the Calendar folder
' dim strSubject as string
' dim strLocation as string
' strSubject = Rst.Fields("urn:schemas:httpmail:subject")
' strLocation = Rst.Fields("urn:schemas:calendar:location")
' if strSubject = "Hello" AND strLocation = "LPB-C" then
' Rst.Delete
' End If

Rst.MoveNext
Loop

' close connections
Rst.Close
Rec.Close

' clear up
Set Rst = Nothing
Set Rec = Nothing

If Err.Number = 0 Then
MsgBox "Good Job!"
End If

End Sub
storm97 2002-11-16
  • 打赏
  • 举报
回复
我前一阵子出差没有上来看,如果你删除邮件,会自动进入删除邮件的文件夹啊!能否将问题说得明白一点?

535

社区成员

发帖
与我相关
我的任务
社区描述
企业开发 Exchange Server
社区管理员
  • 消息协作社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧