'Converting byte array into downloadable outlook mail item in c#
We have used Microsoft azure for our upload and download file functionality. We are able to successfully upload and download files, the issue is with mail items. We are able to upload and download .msg file, when we try to open it, its giving the error "we can't open the item". The code is not breaking anywhere so its difficult to find the issue. Any help would be really helpful.
converting the byte array to mail item
if (data != null) //this is the data from azure
{
HttpResponse response = HttpContext.Current.Response;
Response.Buffer = true;
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment;filename=" + filename);
Response.AddHeader("Content-Length", data.Length.ToString());
Response.BinaryWrite(data);
Response.Flush();
}
Solution 1:[1]
Go to the file properties and check the Permission tab - most likely the file is owned by the system user that runs IIS.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Dmitry Streblechenko |

