![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I am saving Outlook items using the SaveAs method to a Text file using
OlSaveAsType.olTXT as the Parameter however I am losing the Unicode within the Item itself to the SaveAs method (it replaces the unicode with garbage or ???). Is there a way to preserve the unicode but still save it as a txt file? I have tried RTF but this is not what I need because it keeps hold of the Embedded attachments in the mime section and all I want it textual representation of the message. The other option available to me would be to save it to HTML but I know that not all items save to HTML and if I convert an item that is originally RTF it will lose its formatting on conversion. i.e. If oMailItem.BodyFormat = OlBodyFormat.olFormatHTML Then oMailItem.BodyFormat = OlBodyFormat.olFormatRichText End If or vice-versa Any help would be appreciated. Thanks, Chris Below is the Save function I am using: Public Function SaveOlItem(ByVal oItem As Object, ByVal sFile As String, ByVal SaveFileFormat As OlSaveAsType) As Long Dim oMailItem As Outlook.MailItem Dim oMeetingItem As Outlook.MeetingItem Dim oApptItem As Outlook.AppointmentItem Dim oContactItem As Outlook.ContactItem Dim oDistListItem As Outlook.DistListItem Dim oDocItem As Outlook.DocumentItem Dim oNoteItem As Outlook.NoteItem Dim oPostItem As Outlook.PostItem Dim oReportItem As Outlook.ReportItem Dim oTaskItem As Outlook.TaskItem Dim oTaskReqItem As Outlook.TaskRequestItem Dim oTaskReqAccItem As Outlook.TaskRequestAcceptItem Dim oTaskReqDecItem As Outlook.TaskRequestDeclineItem Dim oTaskReqUpItem As Outlook.TaskRequestUpdateItem On Error GoTo Error_Handler Select Case oItem.Class Case olMail Set oMailItem = oItem.Copy oMailItem.SaveAs sFile, SaveFileFormat oMailItem.Copy Set oMailItem = Nothing Case olMeeting Set oMeetingItem = oItem.Copy oMeetingItem.SaveAs sFile, SaveFileFormat Set oMeetingItem = Nothing Case olMeetingRequest Set oMeetingItem = oItem.Copy oMeetingItem.SaveAs sFile, SaveFileFormat Set oMeetingItem = Nothing Case olAppointment Set oApptItem = oItem.Copy oApptItem.SaveAs sFile, SaveFileFormat Set oApptItem = Nothing Case olContact Set oContactItem = oItem.Copy oContactItem.SaveAs sFile, SaveFileFormat Set oContactItem = Nothing Case olDistributionList Set oDistListItem = oItem.Copy oDistListItem.SaveAs sFile, SaveFileFormat Set oDistListItem = Nothing Case olDocument Set oDocItem = oItem.Copy oDocItem.SaveAs sFile, SaveFileFormat Set oDocItem = Nothing Case olNote Set oNoteItem = oItem.Copy oNoteItem.SaveAs sFile, SaveFileFormat Set oNoteItem = Nothing Case olPost Set oPostItem = oItem.Copy oPostItem.SaveAs sFile, SaveFileFormat Set oPostItem = Nothing Case olReport Set oReportItem = oItem.Copy oReportItem.SaveAs sFile, SaveFileFormat Set oReportItem = Nothing Case olTask Set oTaskItem = oItem.Copy oTaskItem.SaveAs sFile, SaveFileFormat Set oTaskItem = Nothing Case olTaskRequest Set oTaskReqItem = oItem.Copy oTaskReqItem.SaveAs sFile, SaveFileFormat Set oTaskReqItem = Nothing Case olTaskRequestAccept Set oTaskReqAccItem = oItem.Copy oTaskReqAccItem.SaveAs sFile, SaveFileFormat Set oTaskReqAccItem = Nothing Case olTaskRequestDecline Set oTaskReqDecItem = oItem.Copy oTaskReqDecItem.SaveAs sFile, SaveFileFormat Set oTaskReqDecItem = Nothing Case olTaskRequestUpdate Set oTaskReqUpItem = oItem.Copy oTaskReqUpItem.SaveAs sFile, SaveFileFormat Set oTaskReqUpItem = Nothing Case Else oItem.SaveAs sFile, SaveFileFormat End Select SaveOlItem = 0 Exit Function Error_Handler: SaveOlItem = Err.Number 'House Cleaning Set oMailItem = Nothing Set oPostItem = Nothing Set oMeetingItem = Nothing Set oApptItem = Nothing Set oContactItem = Nothing Set oDistListItem = Nothing Set oDocItem = Nothing Set oNoteItem = Nothing Set oReportItem = Nothing Set oTaskItem = Nothing Set oTaskReqItem = Nothing Set oTaskReqAccItem = Nothing Set oTaskReqDecItem = Nothing Set oTaskReqUpItem = Nothing End Function |
Ads |
#2
|
|||
|
|||
![]()
What is your version of Outlook? At least in Outlook 2003, a UTF-8 txt file
is created. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "chris" wrote in message oups.com... I am saving Outlook items using the SaveAs method to a Text file using OlSaveAsType.olTXT as the Parameter however I am losing the Unicode within the Item itself to the SaveAs method (it replaces the unicode with garbage or ???). Is there a way to preserve the unicode but still save it as a txt file? I have tried RTF but this is not what I need because it keeps hold of the Embedded attachments in the mime section and all I want it textual representation of the message. The other option available to me would be to save it to HTML but I know that not all items save to HTML and if I convert an item that is originally RTF it will lose its formatting on conversion. i.e. If oMailItem.BodyFormat = OlBodyFormat.olFormatHTML Then oMailItem.BodyFormat = OlBodyFormat.olFormatRichText End If or vice-versa Any help would be appreciated. Thanks, Chris Below is the Save function I am using: Public Function SaveOlItem(ByVal oItem As Object, ByVal sFile As String, ByVal SaveFileFormat As OlSaveAsType) As Long Dim oMailItem As Outlook.MailItem Dim oMeetingItem As Outlook.MeetingItem Dim oApptItem As Outlook.AppointmentItem Dim oContactItem As Outlook.ContactItem Dim oDistListItem As Outlook.DistListItem Dim oDocItem As Outlook.DocumentItem Dim oNoteItem As Outlook.NoteItem Dim oPostItem As Outlook.PostItem Dim oReportItem As Outlook.ReportItem Dim oTaskItem As Outlook.TaskItem Dim oTaskReqItem As Outlook.TaskRequestItem Dim oTaskReqAccItem As Outlook.TaskRequestAcceptItem Dim oTaskReqDecItem As Outlook.TaskRequestDeclineItem Dim oTaskReqUpItem As Outlook.TaskRequestUpdateItem On Error GoTo Error_Handler Select Case oItem.Class Case olMail Set oMailItem = oItem.Copy oMailItem.SaveAs sFile, SaveFileFormat oMailItem.Copy Set oMailItem = Nothing Case olMeeting Set oMeetingItem = oItem.Copy oMeetingItem.SaveAs sFile, SaveFileFormat Set oMeetingItem = Nothing Case olMeetingRequest Set oMeetingItem = oItem.Copy oMeetingItem.SaveAs sFile, SaveFileFormat Set oMeetingItem = Nothing Case olAppointment Set oApptItem = oItem.Copy oApptItem.SaveAs sFile, SaveFileFormat Set oApptItem = Nothing Case olContact Set oContactItem = oItem.Copy oContactItem.SaveAs sFile, SaveFileFormat Set oContactItem = Nothing Case olDistributionList Set oDistListItem = oItem.Copy oDistListItem.SaveAs sFile, SaveFileFormat Set oDistListItem = Nothing Case olDocument Set oDocItem = oItem.Copy oDocItem.SaveAs sFile, SaveFileFormat Set oDocItem = Nothing Case olNote Set oNoteItem = oItem.Copy oNoteItem.SaveAs sFile, SaveFileFormat Set oNoteItem = Nothing Case olPost Set oPostItem = oItem.Copy oPostItem.SaveAs sFile, SaveFileFormat Set oPostItem = Nothing Case olReport Set oReportItem = oItem.Copy oReportItem.SaveAs sFile, SaveFileFormat Set oReportItem = Nothing Case olTask Set oTaskItem = oItem.Copy oTaskItem.SaveAs sFile, SaveFileFormat Set oTaskItem = Nothing Case olTaskRequest Set oTaskReqItem = oItem.Copy oTaskReqItem.SaveAs sFile, SaveFileFormat Set oTaskReqItem = Nothing Case olTaskRequestAccept Set oTaskReqAccItem = oItem.Copy oTaskReqAccItem.SaveAs sFile, SaveFileFormat Set oTaskReqAccItem = Nothing Case olTaskRequestDecline Set oTaskReqDecItem = oItem.Copy oTaskReqDecItem.SaveAs sFile, SaveFileFormat Set oTaskReqDecItem = Nothing Case olTaskRequestUpdate Set oTaskReqUpItem = oItem.Copy oTaskReqUpItem.SaveAs sFile, SaveFileFormat Set oTaskReqUpItem = Nothing Case Else oItem.SaveAs sFile, SaveFileFormat End Select SaveOlItem = 0 Exit Function Error_Handler: SaveOlItem = Err.Number 'House Cleaning Set oMailItem = Nothing Set oPostItem = Nothing Set oMeetingItem = Nothing Set oApptItem = Nothing Set oContactItem = Nothing Set oDistListItem = Nothing Set oDocItem = Nothing Set oNoteItem = Nothing Set oReportItem = Nothing Set oTaskItem = Nothing Set oTaskReqItem = Nothing Set oTaskReqAccItem = Nothing Set oTaskReqDecItem = Nothing Set oTaskReqUpItem = Nothing End Function |
#3
|
|||
|
|||
![]()
Dimitry,
I'm using 2003 (11.6359.6408) SP1. I am surprised with this aswell. I also thought Outlook would handle the Unicode but apparently not. Is there a setting that may have been set that would change this? In "Options/Other/Advanced Options" the Check box "Use Unicode Message Format when saving message", is checked. and the only other place I see Unicode is in "Options/Mail Format/International Options" and the Preferred Encoding is set to "Unicode (UTF-8)". I'm lost at this point. Chris Dmitry Streblechenko wrote: What is your version of Outlook? At least in Outlook 2003, a UTF-8 txt file is created. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "chris" wrote in message oups.com... I am saving Outlook items using the SaveAs method to a Text file using OlSaveAsType.olTXT as the Parameter however I am losing the Unicode within the Item itself to the SaveAs method (it replaces the unicode with garbage or ???). Is there a way to preserve the unicode but still save it as a txt file? I have tried RTF but this is not what I need because it keeps hold of the Embedded attachments in the mime section and all I want it textual representation of the message. The other option available to me would be to save it to HTML but I know that not all items save to HTML and if I convert an item that is originally RTF it will lose its formatting on conversion. i.e. If oMailItem.BodyFormat = OlBodyFormat.olFormatHTML Then oMailItem.BodyFormat = OlBodyFormat.olFormatRichText End If or vice-versa Any help would be appreciated. Thanks, Chris Below is the Save function I am using: Public Function SaveOlItem(ByVal oItem As Object, ByVal sFile As String, ByVal SaveFileFormat As OlSaveAsType) As Long Dim oMailItem As Outlook.MailItem Dim oMeetingItem As Outlook.MeetingItem Dim oApptItem As Outlook.AppointmentItem Dim oContactItem As Outlook.ContactItem Dim oDistListItem As Outlook.DistListItem Dim oDocItem As Outlook.DocumentItem Dim oNoteItem As Outlook.NoteItem Dim oPostItem As Outlook.PostItem Dim oReportItem As Outlook.ReportItem Dim oTaskItem As Outlook.TaskItem Dim oTaskReqItem As Outlook.TaskRequestItem Dim oTaskReqAccItem As Outlook.TaskRequestAcceptItem Dim oTaskReqDecItem As Outlook.TaskRequestDeclineItem Dim oTaskReqUpItem As Outlook.TaskRequestUpdateItem On Error GoTo Error_Handler Select Case oItem.Class Case olMail Set oMailItem = oItem.Copy oMailItem.SaveAs sFile, SaveFileFormat oMailItem.Copy Set oMailItem = Nothing Case olMeeting Set oMeetingItem = oItem.Copy oMeetingItem.SaveAs sFile, SaveFileFormat Set oMeetingItem = Nothing Case olMeetingRequest Set oMeetingItem = oItem.Copy oMeetingItem.SaveAs sFile, SaveFileFormat Set oMeetingItem = Nothing Case olAppointment Set oApptItem = oItem.Copy oApptItem.SaveAs sFile, SaveFileFormat Set oApptItem = Nothing Case olContact Set oContactItem = oItem.Copy oContactItem.SaveAs sFile, SaveFileFormat Set oContactItem = Nothing Case olDistributionList Set oDistListItem = oItem.Copy oDistListItem.SaveAs sFile, SaveFileFormat Set oDistListItem = Nothing Case olDocument Set oDocItem = oItem.Copy oDocItem.SaveAs sFile, SaveFileFormat Set oDocItem = Nothing Case olNote Set oNoteItem = oItem.Copy oNoteItem.SaveAs sFile, SaveFileFormat Set oNoteItem = Nothing Case olPost Set oPostItem = oItem.Copy oPostItem.SaveAs sFile, SaveFileFormat Set oPostItem = Nothing Case olReport Set oReportItem = oItem.Copy oReportItem.SaveAs sFile, SaveFileFormat Set oReportItem = Nothing Case olTask Set oTaskItem = oItem.Copy oTaskItem.SaveAs sFile, SaveFileFormat Set oTaskItem = Nothing Case olTaskRequest Set oTaskReqItem = oItem.Copy oTaskReqItem.SaveAs sFile, SaveFileFormat Set oTaskReqItem = Nothing Case olTaskRequestAccept Set oTaskReqAccItem = oItem.Copy oTaskReqAccItem.SaveAs sFile, SaveFileFormat Set oTaskReqAccItem = Nothing Case olTaskRequestDecline Set oTaskReqDecItem = oItem.Copy oTaskReqDecItem.SaveAs sFile, SaveFileFormat Set oTaskReqDecItem = Nothing Case olTaskRequestUpdate Set oTaskReqUpItem = oItem.Copy oTaskReqUpItem.SaveAs sFile, SaveFileFormat Set oTaskReqUpItem = Nothing Case Else oItem.SaveAs sFile, SaveFileFormat End Select SaveOlItem = 0 Exit Function Error_Handler: SaveOlItem = Err.Number 'House Cleaning Set oMailItem = Nothing Set oPostItem = Nothing Set oMeetingItem = Nothing Set oApptItem = Nothing Set oContactItem = Nothing Set oDistListItem = Nothing Set oDocItem = Nothing Set oNoteItem = Nothing Set oReportItem = Nothing Set oTaskItem = Nothing Set oTaskReqItem = Nothing Set oTaskReqAccItem = Nothing Set oTaskReqDecItem = Nothing Set oTaskReqUpItem = Nothing End Function |
#4
|
|||
|
|||
![]()
Dimitry,
I also notices that when I create a new mail item and insert unicode..... It work when I saveAs to txt file but that is before I send it and it prompts me for the encoding On the receiving mail address or from my Sent Items folder, the message behave as before when I save it. Lots of Garbage????? Any idea why this is? Regards, Chris chris wrote: Dimitry, I'm using 2003 (11.6359.6408) SP1. I am surprised with this aswell. I also thought Outlook would handle the Unicode but apparently not. Is there a setting that may have been set that would change this? In "Options/Other/Advanced Options" the Check box "Use Unicode Message Format when saving message", is checked. and the only other place I see Unicode is in "Options/Mail Format/International Options" and the Preferred Encoding is set to "Unicode (UTF-8)". I'm lost at this point. Chris Dmitry Streblechenko wrote: What is your version of Outlook? At least in Outlook 2003, a UTF-8 txt file is created. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "chris" wrote in message oups.com... I am saving Outlook items using the SaveAs method to a Text file using OlSaveAsType.olTXT as the Parameter however I am losing the Unicode within the Item itself to the SaveAs method (it replaces the unicode with garbage or ???). Is there a way to preserve the unicode but still save it as a txt file? I have tried RTF but this is not what I need because it keeps hold of the Embedded attachments in the mime section and all I want it textual representation of the message. The other option available to me would be to save it to HTML but I know that not all items save to HTML and if I convert an item that is originally RTF it will lose its formatting on conversion. i.e. If oMailItem.BodyFormat = OlBodyFormat.olFormatHTML Then oMailItem.BodyFormat = OlBodyFormat.olFormatRichText End If or vice-versa Any help would be appreciated. Thanks, Chris Below is the Save function I am using: Public Function SaveOlItem(ByVal oItem As Object, ByVal sFile As String, ByVal SaveFileFormat As OlSaveAsType) As Long Dim oMailItem As Outlook.MailItem Dim oMeetingItem As Outlook.MeetingItem Dim oApptItem As Outlook.AppointmentItem Dim oContactItem As Outlook.ContactItem Dim oDistListItem As Outlook.DistListItem Dim oDocItem As Outlook.DocumentItem Dim oNoteItem As Outlook.NoteItem Dim oPostItem As Outlook.PostItem Dim oReportItem As Outlook.ReportItem Dim oTaskItem As Outlook.TaskItem Dim oTaskReqItem As Outlook.TaskRequestItem Dim oTaskReqAccItem As Outlook.TaskRequestAcceptItem Dim oTaskReqDecItem As Outlook.TaskRequestDeclineItem Dim oTaskReqUpItem As Outlook.TaskRequestUpdateItem On Error GoTo Error_Handler Select Case oItem.Class Case olMail Set oMailItem = oItem.Copy oMailItem.SaveAs sFile, SaveFileFormat oMailItem.Copy Set oMailItem = Nothing Case olMeeting Set oMeetingItem = oItem.Copy oMeetingItem.SaveAs sFile, SaveFileFormat Set oMeetingItem = Nothing Case olMeetingRequest Set oMeetingItem = oItem.Copy oMeetingItem.SaveAs sFile, SaveFileFormat Set oMeetingItem = Nothing Case olAppointment Set oApptItem = oItem.Copy oApptItem.SaveAs sFile, SaveFileFormat Set oApptItem = Nothing Case olContact Set oContactItem = oItem.Copy oContactItem.SaveAs sFile, SaveFileFormat Set oContactItem = Nothing Case olDistributionList Set oDistListItem = oItem.Copy oDistListItem.SaveAs sFile, SaveFileFormat Set oDistListItem = Nothing Case olDocument Set oDocItem = oItem.Copy oDocItem.SaveAs sFile, SaveFileFormat Set oDocItem = Nothing Case olNote Set oNoteItem = oItem.Copy oNoteItem.SaveAs sFile, SaveFileFormat Set oNoteItem = Nothing Case olPost Set oPostItem = oItem.Copy oPostItem.SaveAs sFile, SaveFileFormat Set oPostItem = Nothing Case olReport Set oReportItem = oItem.Copy oReportItem.SaveAs sFile, SaveFileFormat Set oReportItem = Nothing Case olTask Set oTaskItem = oItem.Copy oTaskItem.SaveAs sFile, SaveFileFormat Set oTaskItem = Nothing Case olTaskRequest Set oTaskReqItem = oItem.Copy oTaskReqItem.SaveAs sFile, SaveFileFormat Set oTaskReqItem = Nothing Case olTaskRequestAccept Set oTaskReqAccItem = oItem.Copy oTaskReqAccItem.SaveAs sFile, SaveFileFormat Set oTaskReqAccItem = Nothing Case olTaskRequestDecline Set oTaskReqDecItem = oItem.Copy oTaskReqDecItem.SaveAs sFile, SaveFileFormat Set oTaskReqDecItem = Nothing Case olTaskRequestUpdate Set oTaskReqUpItem = oItem.Copy oTaskReqUpItem.SaveAs sFile, SaveFileFormat Set oTaskReqUpItem = Nothing Case Else oItem.SaveAs sFile, SaveFileFormat End Select SaveOlItem = 0 Exit Function Error_Handler: SaveOlItem = Err.Number 'House Cleaning Set oMailItem = Nothing Set oPostItem = Nothing Set oMeetingItem = Nothing Set oApptItem = Nothing Set oContactItem = Nothing Set oDistListItem = Nothing Set oDocItem = Nothing Set oNoteItem = Nothing Set oReportItem = Nothing Set oTaskItem = Nothing Set oTaskReqItem = Nothing Set oTaskReqAccItem = Nothing Set oTaskReqDecItem = Nothing Set oTaskReqUpItem = Nothing End Function |
#5
|
|||
|
|||
![]()
Another thing is that it is using Word as the editor when I create a
mail item which would explain why it is saving the unicode charactors. chris wrote: Dimitry, I also notices that when I create a new mail item and insert unicode..... It work when I saveAs to txt file but that is before I send it and it prompts me for the encoding On the receiving mail address or from my Sent Items folder, the message behave as before when I save it. Lots of Garbage????? Any idea why this is? Regards, Chris chris wrote: Dimitry, I'm using 2003 (11.6359.6408) SP1. I am surprised with this aswell. I also thought Outlook would handle the Unicode but apparently not. Is there a setting that may have been set that would change this? In "Options/Other/Advanced Options" the Check box "Use Unicode Message Format when saving message", is checked. and the only other place I see Unicode is in "Options/Mail Format/International Options" and the Preferred Encoding is set to "Unicode (UTF-8)". I'm lost at this point. Chris Dmitry Streblechenko wrote: What is your version of Outlook? At least in Outlook 2003, a UTF-8 txt file is created. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "chris" wrote in message oups.com... I am saving Outlook items using the SaveAs method to a Text file using OlSaveAsType.olTXT as the Parameter however I am losing the Unicode within the Item itself to the SaveAs method (it replaces the unicode with garbage or ???). Is there a way to preserve the unicode but still save it as a txt file? I have tried RTF but this is not what I need because it keeps hold of the Embedded attachments in the mime section and all I want it textual representation of the message. The other option available to me would be to save it to HTML but I know that not all items save to HTML and if I convert an item that is originally RTF it will lose its formatting on conversion. i.e. If oMailItem.BodyFormat = OlBodyFormat.olFormatHTML Then oMailItem.BodyFormat = OlBodyFormat.olFormatRichText End If or vice-versa Any help would be appreciated. Thanks, Chris Below is the Save function I am using: Public Function SaveOlItem(ByVal oItem As Object, ByVal sFile As String, ByVal SaveFileFormat As OlSaveAsType) As Long Dim oMailItem As Outlook.MailItem Dim oMeetingItem As Outlook.MeetingItem Dim oApptItem As Outlook.AppointmentItem Dim oContactItem As Outlook.ContactItem Dim oDistListItem As Outlook.DistListItem Dim oDocItem As Outlook.DocumentItem Dim oNoteItem As Outlook.NoteItem Dim oPostItem As Outlook.PostItem Dim oReportItem As Outlook.ReportItem Dim oTaskItem As Outlook.TaskItem Dim oTaskReqItem As Outlook.TaskRequestItem Dim oTaskReqAccItem As Outlook.TaskRequestAcceptItem Dim oTaskReqDecItem As Outlook.TaskRequestDeclineItem Dim oTaskReqUpItem As Outlook.TaskRequestUpdateItem On Error GoTo Error_Handler Select Case oItem.Class Case olMail Set oMailItem = oItem.Copy oMailItem.SaveAs sFile, SaveFileFormat oMailItem.Copy Set oMailItem = Nothing Case olMeeting Set oMeetingItem = oItem.Copy oMeetingItem.SaveAs sFile, SaveFileFormat Set oMeetingItem = Nothing Case olMeetingRequest Set oMeetingItem = oItem.Copy oMeetingItem.SaveAs sFile, SaveFileFormat Set oMeetingItem = Nothing Case olAppointment Set oApptItem = oItem.Copy oApptItem.SaveAs sFile, SaveFileFormat Set oApptItem = Nothing Case olContact Set oContactItem = oItem.Copy oContactItem.SaveAs sFile, SaveFileFormat Set oContactItem = Nothing Case olDistributionList Set oDistListItem = oItem.Copy oDistListItem.SaveAs sFile, SaveFileFormat Set oDistListItem = Nothing Case olDocument Set oDocItem = oItem.Copy oDocItem.SaveAs sFile, SaveFileFormat Set oDocItem = Nothing Case olNote Set oNoteItem = oItem.Copy oNoteItem.SaveAs sFile, SaveFileFormat Set oNoteItem = Nothing Case olPost Set oPostItem = oItem.Copy oPostItem.SaveAs sFile, SaveFileFormat Set oPostItem = Nothing Case olReport Set oReportItem = oItem.Copy oReportItem.SaveAs sFile, SaveFileFormat Set oReportItem = Nothing Case olTask Set oTaskItem = oItem.Copy oTaskItem.SaveAs sFile, SaveFileFormat Set oTaskItem = Nothing Case olTaskRequest Set oTaskReqItem = oItem.Copy oTaskReqItem.SaveAs sFile, SaveFileFormat Set oTaskReqItem = Nothing Case olTaskRequestAccept Set oTaskReqAccItem = oItem.Copy oTaskReqAccItem.SaveAs sFile, SaveFileFormat Set oTaskReqAccItem = Nothing Case olTaskRequestDecline Set oTaskReqDecItem = oItem.Copy oTaskReqDecItem.SaveAs sFile, SaveFileFormat Set oTaskReqDecItem = Nothing Case olTaskRequestUpdate Set oTaskReqUpItem = oItem.Copy oTaskReqUpItem.SaveAs sFile, SaveFileFormat Set oTaskReqUpItem = Nothing Case Else oItem.SaveAs sFile, SaveFileFormat End Select SaveOlItem = 0 Exit Function Error_Handler: SaveOlItem = Err.Number 'House Cleaning Set oMailItem = Nothing Set oPostItem = Nothing Set oMeetingItem = Nothing Set oApptItem = Nothing Set oContactItem = Nothing Set oDistListItem = Nothing Set oDocItem = Nothing Set oNoteItem = Nothing Set oReportItem = Nothing Set oTaskItem = Nothing Set oTaskReqItem = Nothing Set oTaskReqAccItem = Nothing Set oTaskReqDecItem = Nothing Set oTaskReqUpItem = Nothing End Function |
#6
|
|||
|
|||
![]()
What is the outgoing message format (HTML, RTF, text)?
Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "chris" wrote in message ups.com... Another thing is that it is using Word as the editor when I create a mail item which would explain why it is saving the unicode charactors. chris wrote: Dimitry, I also notices that when I create a new mail item and insert unicode..... It work when I saveAs to txt file but that is before I send it and it prompts me for the encoding On the receiving mail address or from my Sent Items folder, the message behave as before when I save it. Lots of Garbage????? Any idea why this is? Regards, Chris chris wrote: Dimitry, I'm using 2003 (11.6359.6408) SP1. I am surprised with this aswell. I also thought Outlook would handle the Unicode but apparently not. Is there a setting that may have been set that would change this? In "Options/Other/Advanced Options" the Check box "Use Unicode Message Format when saving message", is checked. and the only other place I see Unicode is in "Options/Mail Format/International Options" and the Preferred Encoding is set to "Unicode (UTF-8)". I'm lost at this point. Chris Dmitry Streblechenko wrote: What is your version of Outlook? At least in Outlook 2003, a UTF-8 txt file is created. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "chris" wrote in message oups.com... I am saving Outlook items using the SaveAs method to a Text file using OlSaveAsType.olTXT as the Parameter however I am losing the Unicode within the Item itself to the SaveAs method (it replaces the unicode with garbage or ???). Is there a way to preserve the unicode but still save it as a txt file? I have tried RTF but this is not what I need because it keeps hold of the Embedded attachments in the mime section and all I want it textual representation of the message. The other option available to me would be to save it to HTML but I know that not all items save to HTML and if I convert an item that is originally RTF it will lose its formatting on conversion. i.e. If oMailItem.BodyFormat = OlBodyFormat.olFormatHTML Then oMailItem.BodyFormat = OlBodyFormat.olFormatRichText End If or vice-versa Any help would be appreciated. Thanks, Chris Below is the Save function I am using: Public Function SaveOlItem(ByVal oItem As Object, ByVal sFile As String, ByVal SaveFileFormat As OlSaveAsType) As Long Dim oMailItem As Outlook.MailItem Dim oMeetingItem As Outlook.MeetingItem Dim oApptItem As Outlook.AppointmentItem Dim oContactItem As Outlook.ContactItem Dim oDistListItem As Outlook.DistListItem Dim oDocItem As Outlook.DocumentItem Dim oNoteItem As Outlook.NoteItem Dim oPostItem As Outlook.PostItem Dim oReportItem As Outlook.ReportItem Dim oTaskItem As Outlook.TaskItem Dim oTaskReqItem As Outlook.TaskRequestItem Dim oTaskReqAccItem As Outlook.TaskRequestAcceptItem Dim oTaskReqDecItem As Outlook.TaskRequestDeclineItem Dim oTaskReqUpItem As Outlook.TaskRequestUpdateItem On Error GoTo Error_Handler Select Case oItem.Class Case olMail Set oMailItem = oItem.Copy oMailItem.SaveAs sFile, SaveFileFormat oMailItem.Copy Set oMailItem = Nothing Case olMeeting Set oMeetingItem = oItem.Copy oMeetingItem.SaveAs sFile, SaveFileFormat Set oMeetingItem = Nothing Case olMeetingRequest Set oMeetingItem = oItem.Copy oMeetingItem.SaveAs sFile, SaveFileFormat Set oMeetingItem = Nothing Case olAppointment Set oApptItem = oItem.Copy oApptItem.SaveAs sFile, SaveFileFormat Set oApptItem = Nothing Case olContact Set oContactItem = oItem.Copy oContactItem.SaveAs sFile, SaveFileFormat Set oContactItem = Nothing Case olDistributionList Set oDistListItem = oItem.Copy oDistListItem.SaveAs sFile, SaveFileFormat Set oDistListItem = Nothing Case olDocument Set oDocItem = oItem.Copy oDocItem.SaveAs sFile, SaveFileFormat Set oDocItem = Nothing Case olNote Set oNoteItem = oItem.Copy oNoteItem.SaveAs sFile, SaveFileFormat Set oNoteItem = Nothing Case olPost Set oPostItem = oItem.Copy oPostItem.SaveAs sFile, SaveFileFormat Set oPostItem = Nothing Case olReport Set oReportItem = oItem.Copy oReportItem.SaveAs sFile, SaveFileFormat Set oReportItem = Nothing Case olTask Set oTaskItem = oItem.Copy oTaskItem.SaveAs sFile, SaveFileFormat Set oTaskItem = Nothing Case olTaskRequest Set oTaskReqItem = oItem.Copy oTaskReqItem.SaveAs sFile, SaveFileFormat Set oTaskReqItem = Nothing Case olTaskRequestAccept Set oTaskReqAccItem = oItem.Copy oTaskReqAccItem.SaveAs sFile, SaveFileFormat Set oTaskReqAccItem = Nothing Case olTaskRequestDecline Set oTaskReqDecItem = oItem.Copy oTaskReqDecItem.SaveAs sFile, SaveFileFormat Set oTaskReqDecItem = Nothing Case olTaskRequestUpdate Set oTaskReqUpItem = oItem.Copy oTaskReqUpItem.SaveAs sFile, SaveFileFormat Set oTaskReqUpItem = Nothing Case Else oItem.SaveAs sFile, SaveFileFormat End Select SaveOlItem = 0 Exit Function Error_Handler: SaveOlItem = Err.Number 'House Cleaning Set oMailItem = Nothing Set oPostItem = Nothing Set oMeetingItem = Nothing Set oApptItem = Nothing Set oContactItem = Nothing Set oDistListItem = Nothing Set oDocItem = Nothing Set oNoteItem = Nothing Set oReportItem = Nothing Set oTaskItem = Nothing Set oTaskReqItem = Nothing Set oTaskReqAccItem = Nothing Set oTaskReqDecItem = Nothing Set oTaskReqUpItem = Nothing End Function |
#7
|
|||
|
|||
![]()
The Message format varies. Most are RTF though although I do believe I
have come across other formats. I know that changing between HTML and RTF will result in losing the Format information. Some of the items are Plain text that contain the Unicode do I need to change the format to RTF or HTML before I save as type olTXT? Dmitry Streblechenko wrote: What is the outgoing message format (HTML, RTF, text)? Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "chris" wrote in message ups.com... Another thing is that it is using Word as the editor when I create a mail item which would explain why it is saving the unicode charactors. chris wrote: Dimitry, I also notices that when I create a new mail item and insert unicode..... It work when I saveAs to txt file but that is before I send it and it prompts me for the encoding On the receiving mail address or from my Sent Items folder, the message behave as before when I save it. Lots of Garbage????? Any idea why this is? Regards, Chris chris wrote: Dimitry, I'm using 2003 (11.6359.6408) SP1. I am surprised with this aswell. I also thought Outlook would handle the Unicode but apparently not. Is there a setting that may have been set that would change this? In "Options/Other/Advanced Options" the Check box "Use Unicode Message Format when saving message", is checked. and the only other place I see Unicode is in "Options/Mail Format/International Options" and the Preferred Encoding is set to "Unicode (UTF-8)". I'm lost at this point. Chris Dmitry Streblechenko wrote: What is your version of Outlook? At least in Outlook 2003, a UTF-8 txt file is created. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "chris" wrote in message oups.com... I am saving Outlook items using the SaveAs method to a Text file using OlSaveAsType.olTXT as the Parameter however I am losing the Unicode within the Item itself to the SaveAs method (it replaces the unicode with garbage or ???). Is there a way to preserve the unicode but still save it as a txt file? I have tried RTF but this is not what I need because it keeps hold of the Embedded attachments in the mime section and all I want it textual representation of the message. The other option available to me would be to save it to HTML but I know that not all items save to HTML and if I convert an item that is originally RTF it will lose its formatting on conversion. i.e. If oMailItem.BodyFormat = OlBodyFormat.olFormatHTML Then oMailItem.BodyFormat = OlBodyFormat.olFormatRichText End If or vice-versa Any help would be appreciated. Thanks, Chris Below is the Save function I am using: Public Function SaveOlItem(ByVal oItem As Object, ByVal sFile As String, ByVal SaveFileFormat As OlSaveAsType) As Long Dim oMailItem As Outlook.MailItem Dim oMeetingItem As Outlook.MeetingItem Dim oApptItem As Outlook.AppointmentItem Dim oContactItem As Outlook.ContactItem Dim oDistListItem As Outlook.DistListItem Dim oDocItem As Outlook.DocumentItem Dim oNoteItem As Outlook.NoteItem Dim oPostItem As Outlook.PostItem Dim oReportItem As Outlook.ReportItem Dim oTaskItem As Outlook.TaskItem Dim oTaskReqItem As Outlook.TaskRequestItem Dim oTaskReqAccItem As Outlook.TaskRequestAcceptItem Dim oTaskReqDecItem As Outlook.TaskRequestDeclineItem Dim oTaskReqUpItem As Outlook.TaskRequestUpdateItem On Error GoTo Error_Handler Select Case oItem.Class Case olMail Set oMailItem = oItem.Copy oMailItem.SaveAs sFile, SaveFileFormat oMailItem.Copy Set oMailItem = Nothing Case olMeeting Set oMeetingItem = oItem.Copy oMeetingItem.SaveAs sFile, SaveFileFormat Set oMeetingItem = Nothing Case olMeetingRequest Set oMeetingItem = oItem.Copy oMeetingItem.SaveAs sFile, SaveFileFormat Set oMeetingItem = Nothing Case olAppointment Set oApptItem = oItem.Copy oApptItem.SaveAs sFile, SaveFileFormat Set oApptItem = Nothing Case olContact Set oContactItem = oItem.Copy oContactItem.SaveAs sFile, SaveFileFormat Set oContactItem = Nothing Case olDistributionList Set oDistListItem = oItem.Copy oDistListItem.SaveAs sFile, SaveFileFormat Set oDistListItem = Nothing Case olDocument Set oDocItem = oItem.Copy oDocItem.SaveAs sFile, SaveFileFormat Set oDocItem = Nothing Case olNote Set oNoteItem = oItem.Copy oNoteItem.SaveAs sFile, SaveFileFormat Set oNoteItem = Nothing Case olPost Set oPostItem = oItem.Copy oPostItem.SaveAs sFile, SaveFileFormat Set oPostItem = Nothing Case olReport Set oReportItem = oItem.Copy oReportItem.SaveAs sFile, SaveFileFormat Set oReportItem = Nothing Case olTask Set oTaskItem = oItem.Copy oTaskItem.SaveAs sFile, SaveFileFormat Set oTaskItem = Nothing Case olTaskRequest Set oTaskReqItem = oItem.Copy oTaskReqItem.SaveAs sFile, SaveFileFormat Set oTaskReqItem = Nothing Case olTaskRequestAccept Set oTaskReqAccItem = oItem.Copy oTaskReqAccItem.SaveAs sFile, SaveFileFormat Set oTaskReqAccItem = Nothing Case olTaskRequestDecline Set oTaskReqDecItem = oItem.Copy oTaskReqDecItem.SaveAs sFile, SaveFileFormat Set oTaskReqDecItem = Nothing Case olTaskRequestUpdate Set oTaskReqUpItem = oItem.Copy oTaskReqUpItem.SaveAs sFile, SaveFileFormat Set oTaskReqUpItem = Nothing Case Else oItem.SaveAs sFile, SaveFileFormat End Select SaveOlItem = 0 Exit Function Error_Handler: SaveOlItem = Err.Number 'House Cleaning Set oMailItem = Nothing Set oPostItem = Nothing Set oMeetingItem = Nothing Set oApptItem = Nothing Set oContactItem = Nothing Set oDistListItem = Nothing Set oDocItem = Nothing Set oNoteItem = Nothing Set oReportItem = Nothing Set oTaskItem = Nothing Set oTaskReqItem = Nothing Set oTaskReqAccItem = Nothing Set oTaskReqDecItem = Nothing Set oTaskReqUpItem = Nothing End Function |
#8
|
|||
|
|||
![]()
Save the message in question as an MSG file (File | Save As), zip it
(important!) and send to my private e-mail address - I'll take a look. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "chris" wrote in message ups.com... The Message format varies. Most are RTF though although I do believe I have come across other formats. I know that changing between HTML and RTF will result in losing the Format information. Some of the items are Plain text that contain the Unicode do I need to change the format to RTF or HTML before I save as type olTXT? Dmitry Streblechenko wrote: What is the outgoing message format (HTML, RTF, text)? Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "chris" wrote in message ups.com... Another thing is that it is using Word as the editor when I create a mail item which would explain why it is saving the unicode charactors. chris wrote: Dimitry, I also notices that when I create a new mail item and insert unicode..... It work when I saveAs to txt file but that is before I send it and it prompts me for the encoding On the receiving mail address or from my Sent Items folder, the message behave as before when I save it. Lots of Garbage????? Any idea why this is? Regards, Chris chris wrote: Dimitry, I'm using 2003 (11.6359.6408) SP1. I am surprised with this aswell. I also thought Outlook would handle the Unicode but apparently not. Is there a setting that may have been set that would change this? In "Options/Other/Advanced Options" the Check box "Use Unicode Message Format when saving message", is checked. and the only other place I see Unicode is in "Options/Mail Format/International Options" and the Preferred Encoding is set to "Unicode (UTF-8)". I'm lost at this point. Chris Dmitry Streblechenko wrote: What is your version of Outlook? At least in Outlook 2003, a UTF-8 txt file is created. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "chris" wrote in message oups.com... I am saving Outlook items using the SaveAs method to a Text file using OlSaveAsType.olTXT as the Parameter however I am losing the Unicode within the Item itself to the SaveAs method (it replaces the unicode with garbage or ???). Is there a way to preserve the unicode but still save it as a txt file? I have tried RTF but this is not what I need because it keeps hold of the Embedded attachments in the mime section and all I want it textual representation of the message. The other option available to me would be to save it to HTML but I know that not all items save to HTML and if I convert an item that is originally RTF it will lose its formatting on conversion. i.e. If oMailItem.BodyFormat = OlBodyFormat.olFormatHTML Then oMailItem.BodyFormat = OlBodyFormat.olFormatRichText End If or vice-versa Any help would be appreciated. Thanks, Chris Below is the Save function I am using: Public Function SaveOlItem(ByVal oItem As Object, ByVal sFile As String, ByVal SaveFileFormat As OlSaveAsType) As Long Dim oMailItem As Outlook.MailItem Dim oMeetingItem As Outlook.MeetingItem Dim oApptItem As Outlook.AppointmentItem Dim oContactItem As Outlook.ContactItem Dim oDistListItem As Outlook.DistListItem Dim oDocItem As Outlook.DocumentItem Dim oNoteItem As Outlook.NoteItem Dim oPostItem As Outlook.PostItem Dim oReportItem As Outlook.ReportItem Dim oTaskItem As Outlook.TaskItem Dim oTaskReqItem As Outlook.TaskRequestItem Dim oTaskReqAccItem As Outlook.TaskRequestAcceptItem Dim oTaskReqDecItem As Outlook.TaskRequestDeclineItem Dim oTaskReqUpItem As Outlook.TaskRequestUpdateItem On Error GoTo Error_Handler Select Case oItem.Class Case olMail Set oMailItem = oItem.Copy oMailItem.SaveAs sFile, SaveFileFormat oMailItem.Copy Set oMailItem = Nothing Case olMeeting Set oMeetingItem = oItem.Copy oMeetingItem.SaveAs sFile, SaveFileFormat Set oMeetingItem = Nothing Case olMeetingRequest Set oMeetingItem = oItem.Copy oMeetingItem.SaveAs sFile, SaveFileFormat Set oMeetingItem = Nothing Case olAppointment Set oApptItem = oItem.Copy oApptItem.SaveAs sFile, SaveFileFormat Set oApptItem = Nothing Case olContact Set oContactItem = oItem.Copy oContactItem.SaveAs sFile, SaveFileFormat Set oContactItem = Nothing Case olDistributionList Set oDistListItem = oItem.Copy oDistListItem.SaveAs sFile, SaveFileFormat Set oDistListItem = Nothing Case olDocument Set oDocItem = oItem.Copy oDocItem.SaveAs sFile, SaveFileFormat Set oDocItem = Nothing Case olNote Set oNoteItem = oItem.Copy oNoteItem.SaveAs sFile, SaveFileFormat Set oNoteItem = Nothing Case olPost Set oPostItem = oItem.Copy oPostItem.SaveAs sFile, SaveFileFormat Set oPostItem = Nothing Case olReport Set oReportItem = oItem.Copy oReportItem.SaveAs sFile, SaveFileFormat Set oReportItem = Nothing Case olTask Set oTaskItem = oItem.Copy oTaskItem.SaveAs sFile, SaveFileFormat Set oTaskItem = Nothing Case olTaskRequest Set oTaskReqItem = oItem.Copy oTaskReqItem.SaveAs sFile, SaveFileFormat Set oTaskReqItem = Nothing Case olTaskRequestAccept Set oTaskReqAccItem = oItem.Copy oTaskReqAccItem.SaveAs sFile, SaveFileFormat Set oTaskReqAccItem = Nothing Case olTaskRequestDecline Set oTaskReqDecItem = oItem.Copy oTaskReqDecItem.SaveAs sFile, SaveFileFormat Set oTaskReqDecItem = Nothing Case olTaskRequestUpdate Set oTaskReqUpItem = oItem.Copy oTaskReqUpItem.SaveAs sFile, SaveFileFormat Set oTaskReqUpItem = Nothing Case Else oItem.SaveAs sFile, SaveFileFormat End Select SaveOlItem = 0 Exit Function Error_Handler: SaveOlItem = Err.Number 'House Cleaning Set oMailItem = Nothing Set oPostItem = Nothing Set oMeetingItem = Nothing Set oApptItem = Nothing Set oContactItem = Nothing Set oDistListItem = Nothing Set oDocItem = Nothing Set oNoteItem = Nothing Set oReportItem = Nothing Set oTaskItem = Nothing Set oTaskReqItem = Nothing Set oTaskReqAccItem = Nothing Set oTaskReqDecItem = Nothing Set oTaskReqUpItem = Nothing End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Saving Message as text but keeping unicode | chris | Outlook - General Queries | 0 | July 19th 06 09:30 PM |
Saving text included on customised task page | bg | Outlook - Using Forms | 1 | July 4th 06 03:06 AM |
Saving Subject Text in Excel Doc | bbkixx | Outlook and VBA | 1 | June 15th 06 05:09 PM |
Problems saving text in a text box | Dave Haymes | Outlook - Using Contacts | 1 | February 7th 06 12:58 PM |
can't read unicode message(outlook 2003) | ÃÖ¸íÁø | Outlook - General Queries | 0 | January 10th 06 02:37 AM |