有没有办法标记Outlook.MailItem在保存之前已经发送过? [英] Is there a way to flag that the Outlook.MailItem has been sent before it gets saved?
问题描述
我正在构建一个Outlook 2010插件,将其与一些商业软件集成,并制作了一个自定义的ItemSend事件,并使用jason从后端应用了我自己的Web服务。我能够将邮件项目保存为.msg文件(在用户临时文件夹中)。但是当我尝试打开它时
问题是,然后Outlook打开它作为仍在编写的消息,用户可以非常轻松地再次单击"发送"按钮。
I am building an Outlook 2010 addin to integrate it with some business software and have made a custom ItemSend Event and have applied my own webservices from backened using jason . I am able to save the mail item as .msg file (in the users temp folder). but when i try to open it The issue is , then Outlook opens it as a message still being composed and the user could very easily click the Send button again.
有没有办法标记该项目在保存之前已经发送过,所以当它打开后作为可读的电子邮件而不是组合内的电子邮件打开?
Is there a way to flag that the item has been sent before it gets saved so when opened after the fact it opens as a readable email rather than an in-composition email?
i我在下面分享我的代码请指导我完成这个
i am sharing my code below please guide me through this
void Application_ItemSend(object Item, ref bool Cancel)
{
this.passwordpopUpObj = new Forms.PasswordInputPopUp();
passwordpopUpObj.ShowDialog();
passwordpopUpObj.StartPosition = FormStartPosition.CenterParent;
Outlook.MailItem mail = Item as Outlook.MailItem;
if (passwordpopUpObj.textBox1.Text != "")
{
Cancel = true;
BussinessClass cs = new BussinessClass();
string msg = cs.ServerCallSendMail(mail.Subject, mail.To, mail.CC, attachcount, passwordpopUpObj.textBox1.Text);
if (msg == "Success")
{
mail.SaveAs(@"E:\Plugin.net\EmailCipherPlugin\EmailCipherPlugin\Mails" + "\\" + "file3" + @".msg");
MessageBox.Show("Mail Send SuccessFully through Plugin");
mailItem = Item as Outlook.MailItem;
Cancel = true;
foreach (Outlook.Store store in OutlookObject.Session.Stores)
{
if (store.DisplayName == "Email Cipher")
{
Outlook.MAPIFolder pstRootFolder = store.GetRootFolder();
foreach (Folder folder in pstRootFolder.Folders)
{
MessageBox.Show(store.FilePath + folder.FolderPath);
if (folder.Name == "Email cipher Sent")
{
MessageBox.Show( Directory.Exists(@"E:\Plugin.net\EmailCipherPlugin\EmailCipherPlugin\Mails").ToString());
mail.SaveAs(@"E:\Plugin.net\EmailCipherPlugin\EmailCipherPlugin\Mails" + "\\" + "file3" + @".msg", Outlook.OlSaveAsType.olMSG);
}
}
}
}
}
//
else
{
Cancel = true;
MessageBox.Show("Mail Cannot be sent through plugin");
}
}
else
{
MessageBox.Show("mail Send Normally");
Cancel = false;
mail.Categories = "Sent";
mail.SaveAs(@"E:\Plugin.net\EmailCipherPlugin\EmailCipherPlugin\Mails" + "\\" + "outlookfile" + @".msg", Outlook.OlSaveAsType.olMSG);
}
}
SomeOne引导我使用Item add Event但我不清楚在我的代码中使用dat
SomeOne guided me to use Item add Event but i am not clear how to use dat in my code
推荐答案
这篇关于有没有办法标记Outlook.MailItem在保存之前已经发送过?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!