以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  添加附件异常  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=193578)

--  作者:ljh29206
--  发布时间:2024/9/26 16:07:00
--  添加附件异常
            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编辑过]

--  作者:有点蓝
--  发布时间:2024/9/26 16:09:00
--  
很明显是把一个单元格的多个文件当做是一个文件来处理的,当然找不到文件。看看:http://www.foxtable.com/webhelp/topics/2717.htm
--  作者:ljh29206
--  发布时间:2024/10/17 10:21:00
--  
 篮板请教下

        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

我的代码如上  添付的时候 已经是按照集合的形式添付的 了 , 不知道错在哪里  求明指点

--  作者:有点蓝
--  发布时间:2024/10/17 12:18:00
--  
提示什么错误?