简体   繁体   English

在 C# 中将字节数组转换为可下载的 Outlook 邮件项

[英]Converting byte array into downloadable outlook mail item in c#

We have used Microsoft azure for our upload and download file functionality.我们已将 Microsoft azure 用于上传和下载文件功能。 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".我们能够上传和下载 .msg 文件,当我们尝试打开它时,它给出错误“我们无法打开该项目”。 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();
}

在此处输入图片说明

转到文件属性并检查权限选项卡 - 很可能该文件由运行 IIS 的系统用户拥有。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM