| Author |  | 
      
        | RobFarley Newbie
 
  
 
 Joined: 24 November 2010
 Online Status: Offline
 Posts: 1
 | 
          I am getting en error when using the MsgConvert.EmlToMsg function, the error message is "Length cannot be less than zero. Parameter name: length".
           | Posted: 24 November 2010 at 7:40am | IP Logged |   |  
           | 
 |  
 The relevant lines of code are as follows:
 
 Public Shared Sub SaveItemAsMsgFile(ByVal sMsgPath As String, ByVal sEMLPath As String)
 Dim conv As MailBee.Outlook.MsgConvert = New MailBee.Outlook.MsgConvert
 conv.EmlToMsg(sEMLPath, sMsgPath)
 End Sub
 
 sEMLPath is the full file path of the EML file, sMsgPath is the path the MSG file will be saved to (same path, same filename, different extension). When the error occurs a zero-size MSG file is created in the correct location.
 
 The full stack trace is as follows:
 
 at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
 at System.String.Substring(Int32 startIndex, Int32 length)
 at MailBee.Outlook.MsgConvert.a(String A_0)
 at MailBee.Outlook.MsgConvert.a(MailMessage A_0, Stream A_1, Boolean A_2)
 at MailBee.Outlook.MsgConvert.a(MailMessage A_0, String A_1, Boolean A_2)
 at MailBee.Outlook.MsgConvert.a(String A_0, String A_1, Boolean A_2)
 at MailBee.Outlook.MsgConvert.EmlToMsg(String emlFilename, String msgFilename)
 at ExchangeSync.Globals.SaveItemAsMsgFile(String sMsgPath, String sEMLPath) in C:\Development\Dev\Exchange Sync\Globals.VB:line 338
 
 The error is obviously occurring within MsgConvert but gives no indication as to what is actually causing it, I cannot see what (if anything) I can do to correct this. Does anybody have any suggestions? I am using the latest available version of the .NET objects (v6.5).
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | administrator AfterLogic Support
 
  
 
 Joined: 10 November 2003
 Online Status: Offline
 Posts: 22
 | 
          You'll get answer in the Helpdesk.
           | Posted: 24 November 2010 at 7:57am | IP Logged |   |  
           | 
 |  | 
       
        | Back to Top |     | 
       
       
        |  |