For q As Integer = 1 To latestMailItem.Attachments.Count
Dim files As String
Dim FileName As String
FileName = latestMailItem.Attachments(q).FileName
Dim fmat As String = Filename
Dim pathfile As String
pathfile = ProjectPath & "Attachments\" & "files" & "\" & fmat
If FileSys.DirectoryExists(ProjectPath & "Attachments\" & "files") = False Then
FileSys.CreateDirectory(ProjectPath & "Attachments\" & "files")
End If
lst.Add(pathfile) latestMailItem.Attachments(q).SaveAsFile(pathfile)
Next

此主题相关图片如下:屏幕截图 2024-09-26 160106.png

点打开邮件 会弹出这个信息
附件列 添加异常 , 写入绝对路径 , 文件夹里面的问题 打不开 ,请教什么问题呢
[此贴子已经被作者于2024/9/26 16:07:53编辑过]
篮板请教下
Dim lst As New List(of String)
If latestMailItem.Attachments.Count > 0 Then
For q As Integer = 1 To latestMailItem.Attachments.Count
Dim files As String
Dim FileName As String
FileName = latestMailItem.Attachments(q).FileName
Dim fmat As String = Filename
Dim pathfile As String
pathfile = ProjectPath & "Attachments\" & "files" & "\" & fmat
If FileSys.DirectoryExists(ProjectPath & "Attachments\" & "files") = False Then
FileSys.CreateDirectory(ProjectPath & "Attachments\" & "files")
End If
lst.Add(pathfile)
latestMailItem.Attachments(q).SaveAsFile(pathfile) '复制到emailsend 文件夹里面
Next
End If
dra.Lines("附件") = lst
dra.save
我的代码如上 添付的时候 已经是按照集合的形式添付的 了 , 不知道错在哪里 求明指点