1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| private void btnReport_Click(object sender, EventArgs e)
{
ediFolderName_TextChanged(sender, e);
Outlook.Application OutlookApp = new Outlook.Application();
Outlook._MailItem OMailItem = (Outlook._MailItem)OutlookApp.CreateItem(Outlook.OlItemType.olMailItem);
OMailItem.To = EMailAdres.Text;
OMailItem.Subject = EMailSubject.Text;
OMailItem.Body = EMailBody.Text;
OMailItem.Display(false);
String sDisplayName = "MyFirstAttachment";
int iPosition = 1;
int iAttachType = (int)Outlook.OlAttachmentType.olByValue;
Outlook.Attachment oAttach = OMailItem.Attachments.Add(sSource, iAttachType, iPosition, sDisplayName);
Outlook.Attachment oAttach = OMailItem.Attachments.Add("C:\\My Documents\\Values.xls", iAttachType, iPosition, sDisplayName);
if (btnReport.Enabled)
{
DialogResult = DialogResult.OK;
SaveToList();
Close();
}
} |
Partager