English 中文(简体)
A. 在《Aduin展望》中找到一个寄来的电子邮件
原标题:Get the body of an incoming email in an Outlook Addin

我想处理来自交换服务器的邮递,并在我的邮箱中予以节省。 从现在起,我可以随时向每个寄出的邮件发出警报。

我怎么能够接手电子邮件?

   public partial class ThisAddIn
   {
            private void ThisAddIn_Startup(object sender, System.EventArgs e)
            {
                this.Application.NewMail += new ApplicationEvents_11_NewMailEventHandler(AlertWhenNewMail);
            }
            void AlertWhenNewMail()
            {
                MessageBox.Show("New Email Recieved");
            }

            private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
            {
            }
            #region VSTO generated code
            private void InternalStartup()
            {
               this.Startup += new System.EventHandler(ThisAddIn_Startup);
               this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
            }
            #endregion
    }

Also, how to save the email and then just store it in the inbox folder?

最佳回答

前往实际邮件 项目,在新的邮电网活动中使用输入信息。 你对其他职位的答复表明,这给你带来了一定的工作,但我假定我们会这样做,并给你以一些榜样:

void MyApplication_NewMailEx(string anEntryID)
{
  Outlook.NameSpace namespace = this.GetNamespace("MAPI");  
  Outlook.MAPIFolder folder = this.Session.GetDefaultFolder( Outlook.OlDefaultFolders.olFolderInbox );
  Outlook.MailItem mailItem = (Outlook.MailItem) outlookNS.GetItemFromID( anEntryID, folder.StoreID );

  // ... process the mail item
}

回答你提问的第二部分,一旦你通过这一活动持有邮件项目,就会把面装在<<>盒内,因此无需做任何事情。 页: 1

问题回答

这里,你们有2010年展望的答案。 邮电网

    void Application_NewMailEx(string EntryIDCollection)
    {    
        Outlook.MailItem newMail = (Outlook.MailItem) Application.Session.GetItemFromID(EntryIDCollection, System.Reflection.Missing.Value);

        // do whatever you want with the new email...
    }




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签