| @@ -90,7 +90,8 @@ namespace jdis_import | |||||
| list.Add(todo); | list.Add(todo); | ||||
| //Download File | //Download File | ||||
| FileAttachment fAttachment = attachment as FileAttachment; | FileAttachment fAttachment = attachment as FileAttachment; | ||||
| File.WriteAllBytes(fAttachment.Name, fAttachment.Content); | |||||
| string fileAttachmentPath = Path.Combine(_exeDir, fAttachment.FileName); | |||||
| File.WriteAllBytes(fileAttachmentPath, fAttachment.Content); | |||||
| msg.IsRead = true; | msg.IsRead = true; | ||||
| } | } | ||||
| } | } | ||||
| @@ -116,7 +117,7 @@ namespace jdis_import | |||||
| else | else | ||||
| { | { | ||||
| body = string.Format(body, sendMsg.FileName, sendMsg.WorkOrder, string.Format("Had Errors while importing: {0}", sendMsg.Validation)); | body = string.Format(body, sendMsg.FileName, sendMsg.WorkOrder, string.Format("Had Errors while importing: {0}", sendMsg.Validation)); | ||||
| msgToSend.Attachments.AddFileAttachment(sendMsg.FileName); | |||||
| msgToSend.Attachments.AddFileAttachment(Path.Combine(_exeDir, sendMsg.FileName) | |||||
| } | } | ||||
| @@ -125,8 +126,9 @@ namespace jdis_import | |||||
| msgToSend.CcRecipients.Add(new EmailAddress("mcarman@rpmindustries.com")); | msgToSend.CcRecipients.Add(new EmailAddress("mcarman@rpmindustries.com")); | ||||
| msgToSend.Body = body; | msgToSend.Body = body; | ||||
| msgToSend.SendAndSaveCopy(); | msgToSend.SendAndSaveCopy(); | ||||
| if (sendMsg.Success) File.Move(sendMsg.FileName, Path.Combine("Success", sendMsg.FileName)); | |||||
| else File.Move(sendMsg.FileName, Path.Combine("Fail", sendMsg.FileName)); | |||||
| string pathToFile = Path.Combine(_exeDir, sendMsg.FileName); | |||||
| if (sendMsg.Success) File.Move(pathToFile, Path.Combine(_exeDir, "Success", sendMsg.FileName)); | |||||
| else File.Move(sendMsg.FileName, Path.Combine(_exeDir, "Fail", sendMsg.FileName)); | |||||
| } | } | ||||
| } | } | ||||
| catch (MsalException ex) | catch (MsalException ex) | ||||