0

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();
}

enter image description here

RKM
  • 89
  • 1
  • 3
  • 15
  • Could it be that Windows blocks the file? Check the file properties and check the "unblock" box under the "Security" section at the bottom. Does that help? If so, you can programmatically unblock it like here: https://stackoverflow.com/questions/10535578/this-file-is-blocked-because-it-came-from-another-computer-ajax-permission-i – Manu Oct 12 '21 at 08:11
  • Even if I unblock it in properties, im still getting the same error :( – RKM Oct 12 '21 at 08:20

1 Answers1

0

Go to the file properties and check the Permission tab - most likely the file is owned by the system user that runs IIS.

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78