[
  {
    "Id": "646246",
    "ThreadId": "266240",
    "Html": "\r\n<p>I am working on a web page which creates a .PDF file dynamically using CETE Dynamic&nbsp; PDF.&nbsp; This is saved in a memory stream.&nbsp; I then save that file as a .zip using DotNetZip in a memory stream.&nbsp; The resultant zip file is used as an attachment\r\n for an Outlook email message.&nbsp;&nbsp; The problem comes when trying to extract the .zip file in the Outlook email message.&nbsp; I get the following error:</p>\r\n<p><em>An unexpected error is keep you from copying the file.&nbsp; ... Error 0x80070057: the parameter is incorrect.&nbsp;&nbsp;</em></p>\r\n<p>If I then press the &quot;Try Again&quot; button, I get a message about&nbsp;copying the file.&nbsp; &quot;There is already a file with the same name in this location.&quot;&nbsp; I may&nbsp;&quot;copy and replace&quot;, &quot;don't copy &quot;or &quot;copy but keep both files.&quot;&nbsp; The only choice\r\n that doesn't get another message is to not copy.&nbsp; I don't know why it is trying to copy and how to avoid the message.</p>\r\n<p>This is the code I am using:<br>\r\n&nbsp;&nbsp;&nbsp;'put the PDF file into a .zip format<br>\r\n&nbsp;Using zip As ZipFile = New ZipFile<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp; zip.AddEntry(sFileName, oStreamFinal)<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp; zip.ZipErrorAction = ZipErrorAction.Skip<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp; zip.Save(oZipStream)<br>\r\n&nbsp;End Using</p>\r\n<p>&nbsp;' move the stream position to the beginning<br>\r\n&nbsp;oZipStream.Seek(0, SeekOrigin.Begin)</p>\r\n<p>&nbsp;'Quote with any merged documents<br>\r\n&nbsp;oAttachment(0) = New System.Net.Mail.Attachment(oZipStream, sZipFileName)</p>\r\n<p>&nbsp;Thanks!&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>\r\n<p>&nbsp;</p>\r\n",
    "PostedDate": "2011-07-22T11:10:56.157-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "646500",
    "ThreadId": "266240",
    "Html": "<p>based on a quick look, this is not a DotNetZip problem. It seems to me that you are using the System.Net.Mail.Attachment class incorrectly. See the doc page at <a href=\"http://msdn.microsoft.com/en-us/library/6sdktyws.aspx\">http://msdn.microsoft.com/en-us/library/6sdktyws.aspx</a> . The constructor that accepts a stream and a string - the constructor you are using - wants the string to be the Content Type, not the filename. If you want to specify the filename with a stream, then you need to System.Net.Mail.Attachment differently.&nbsp;</p>\n<div style=\"background-color: white; color: black;\">\n<pre><span style=\"color: blue;\">dim</span> ct <span style=\"color: blue;\">As</span> <span style=\"color: blue;\">New</span> ContentType()\r\n<span style=\"color: green;\">' specify the media type for Zip files...</span>\r\nct.MediaType = MediaTypeNames.Application.Zip \r\nct.Name = <span style=\"color: #a31515;\">\"something-\"</span> &amp; DateTime.Now.ToString() &amp; <span style=\"color: #a31515;\">\".zip\"</span>\r\n<span style=\"color: green;\">' Create the attachment.</span>\r\n<span style=\"color: blue;\">dim</span> att <span style=\"color: blue;\">As</span> <span style=\"color: blue;\">New</span> Attachment(oZipStream, ct)\r\nmessage.Attachments.Add(att)\r\n\r\n</pre>\n</div>\n<p>-----</p>\n<p>If that is not the problem, then I don't know.&nbsp; I don't know&nbsp;about Outlook and email attachments.&nbsp; I don't know about \"copy\"&nbsp; \"copy and replace\" or \"copy but keep both\".&nbsp; I don't know what that is and I cannot help you with that.</p>\n<p>I can help with the zip part.&nbsp; What I suggest for diagnosing this problem is to first isolate the problem.&nbsp; Separate the \"zip generation\" from the \"email generation\".&nbsp; In the zip generation part, save the generated zip file to a filesystem file.&nbsp; See if you can correctly read and extract the generated zip file, see if the PDF you extract matches&nbsp;what you expect.&nbsp; If it does, then you know the zip generation is correct.&nbsp;</p>\n<p>After determining that the zip generation works properly, add in the Outlook / attachment piece.</p>\n<p>&nbsp;</p>",
    "PostedDate": "2011-07-23T07:51:01.14-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "647230",
    "ThreadId": "266240",
    "Html": "<p>That worked.&nbsp; Thanks so much for your help!</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2011-07-25T09:19:56.587-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]