On certain email there is an error of SaveAS

Add-in Express™ Support Service
That's what is more important than anything else

On certain email there is an error of SaveAS
 
theaudin yvan




Posts: 2
Joined: 2006-11-06
on certain email there is an error of SaveAS


Try
            If e.Data.GetDataPresent(DataFormats.UnicodeText, True) Then
                'Dim app_outlook As New Microsoft.Office.Interop.Outlook.Application
                OlApp = CType(OutlookAppObj, Outlook._Application)
                Dim Item As Outlook.MailItem
                Dim response As MsgBoxResult

                'Dim eMail As Microsoft.Office.Interop.Outlook.MailItem

                Dim i As Long

                For i = 1 To OlApp.ActiveExplorer.Selection.Count
                    Item = DirectCast(OlApp.ActiveExplorer().Selection(i), Microsoft.Office.Interop.Outlook.MailItem)

                    If My.Computer.FileSystem.FileExists(TreeView1.SelectedNode.FullPath & "" & Item.Subject & ".msg").ToString() Then

                        response = MsgBox("vous voulez réellement écraser (remplacer) le fichier existant?", MsgBoxStyle.YesNo, "Attention fichier existant")

                        If response = MsgBoxResult.Yes Then

                            Item.SaveAs(TreeView1.SelectedNode.FullPath & "" & Item.Subject & ".msg", Microsoft.Office.Interop.Outlook.OlSaveAsType.olMSGUnicode)
                            Item.FlagStatus = Outlook.OlFlagStatus.olFlagComplete
                            Item.Save()
                        End If
                    Else
                         :!: Item.SaveAs(TreeView1.SelectedNode.FullPath & "" & Item.Subject & ".msg", Microsoft.Office.Interop.Outlook.OlSaveAsType.olMSGUnicode)
                        Item.FlagStatus = Outlook.OlFlagStatus.olFlagComplete
                        Item.Save()
                    End If


                Next
                OlApp = Nothing
            End If
        Catch ex As Exception
            MsgBox(ex.Message & vbCrLf & "fonction : TreeView1_DragDrop")
        End Try

User added an image
Posted 06 Nov, 2006 19:03:26 Top
Sergey Grischenko


Add-in Express team


Posts: 7224
Joined: 2004-07-05
Hi Theaudin.

Could you please check in the debugger if the line 588 has the correct path?
Posted 07 Nov, 2006 09:06:07 Top
theaudin yvan




Posts: 2
Joined: 2006-11-06
Thanks

Solution :

Function convert_text(ByVal text As String)
        '  / : * ? | < >

        text = text.Replace("'", "_")
        text = text.Replace("", "_")
        text = text.Replace("/", "_")
        text = text.Replace(":", "_")
        text = text.Replace("*", "_")
        text = text.Replace("?", "_")
        text = text.Replace("|", "_")
        text = text.Replace("<", "_")
        text = text.Replace(">", "_")
        text = text.Replace("""", "_")
        text = text.Replace("(", "_")
        text = text.Replace(")", "_")
        Return text
    End Function
Posted 07 Nov, 2006 16:46:49 Top