none
How to create an Outlook Addin for reading different emails RRS feed

  • Question

  • I would like to create a rule / script that can read two emails by the subject line and forward a mail to another email address.

    example: i recieve an email with subject line "Problem" at 9:00 am. I get another email in 30 minutes later with the subject line "Resolved".

    If i do not get in 30 mins the resolved email, i want to forward this problem email to another email address. how can i set this up by creating rules / scripts? please help


    Michael Martin

    Monday, June 30, 2014 7:26 AM

Answers

  • Hello Michael,

    It looks like you need to develop a VBA macro or add-in for Outlook. If you are going to distribute the code for multiple PCs you need to develop an Outlook add-in. If not, VBA macro is a good choice too (of course, if you are not going to customize the Fluent UI). The Outlook object model is common for all kind of applications.

    I'd recommend starting from the Getting Started with VBA in Outlook 2010 article in MSDN. Then you may find a lot of HOWTO articles in the Concepts (Outlook 2013 developer reference) section.

    If you decide to develop an add-in, see the Outlook Solutions section in MSDN. It provides a lot of walkthroughs and "how to" articles.

    In the code you need to handle the NewMailEx event of the Application class and check the Subject property of all arrived emails. Save the "problem" and "resolved" email EntryID property values in the dictionary (array in VBA). Then start a timer which will be triggered every 30 mins for checking whether a problem arrived in the email is solved. If not, you can forward the arrived "problem" email to another email address. See the Forward method of the MailItem class for more information. You can get an instance of the mail item at any time by using its EntryID value - see GetItemFromID . Be aware, EntryID values can be changed, here is what MSDN states:

    The Entry ID changes when an item is moved into another store, for example, from your Inbox to a Microsoft Exchange Server public folder, or from one Personal Folders (.pst) file to another .pst file. Solutions should not depend on the EntryID property to be unique unless items will not be moved.

    Monday, June 30, 2014 9:02 AM

All replies

  • I would like to create a rule / script that can read two emails by the subject line and forward a mail to another email address.

    example: i recieve an email with subject line "Problem" at 9:00 am. I get another email in 30 minutes later with the subject line "Resolved".

    If i do not get in 30 mins the resolved email, i want to forward this problem email to another email address. how can i set this up by creating rules / scripts? please help


    Michael Martin

    Monday, June 30, 2014 7:28 AM
  • Hello Michael,

    It looks like you need to develop a VBA macro or add-in for Outlook. If you are going to distribute the code for multiple PCs you need to develop an Outlook add-in. If not, VBA macro is a good choice too (of course, if you are not going to customize the Fluent UI). The Outlook object model is common for all kind of applications.

    I'd recommend starting from the Getting Started with VBA in Outlook 2010 article in MSDN. Then you may find a lot of HOWTO articles in the Concepts (Outlook 2013 developer reference) section.

    If you decide to develop an add-in, see the Outlook Solutions section in MSDN. It provides a lot of walkthroughs and "how to" articles.

    In the code you need to handle the NewMailEx event of the Application class and check the Subject property of all arrived emails. Save the "problem" and "resolved" email EntryID property values in the dictionary (array in VBA). Then start a timer which will be triggered every 30 mins for checking whether a problem arrived in the email is solved. If not, you can forward the arrived "problem" email to another email address. See the Forward method of the MailItem class for more information. You can get an instance of the mail item at any time by using its EntryID value - see GetItemFromID . Be aware, EntryID values can be changed, here is what MSDN states:

    The Entry ID changes when an item is moved into another store, for example, from your Inbox to a Microsoft Exchange Server public folder, or from one Personal Folders (.pst) file to another .pst file. Solutions should not depend on the EntryID property to be unique unless items will not be moved.

    Monday, June 30, 2014 9:02 AM
  • Hello Michael,

    Please don't publish duplicates on the forum.

    It looks like you need to develop a VBA macro or add-in for Outlook. If you are going to distribute the code for multiple PCs you need to develop an Outlook add-in. If not, VBA macro is a good choice too (of course, if you are not going to customize the Fluent UI). The Outlook object model is common for all kind of applications.

    I'd recommend starting from the Getting Started with VBA in Outlook 2010 article in MSDN. Then you may find a lot of HOWTO articles in the Concepts (Outlook 2013 developer reference) section.

    If you decide to develop an add-in, see the Outlook Solutions section in MSDN. It provides a lot of walkthroughs and "how to" articles.

    In the code you need to handle the NewMailEx event of the Application class and check the Subject property of all arrived emails. Save the "problem" and "resolved" email EntryID property values in the dictionary (array in VBA). Then start a timer which will be triggered every 30 mins for checking whether a problem arrived in the email is solved. If not, you can forward the arrived "problem" email to another email address. See the Forward method of the MailItem class for more information. You can get an instance of the mail item at any time by using its EntryID value - see GetItemFromID . Be aware, EntryID values can be changed, here is what MSDN states:

    The Entry ID changes when an item is moved into another store, for example, from your Inbox to a Microsoft Exchange Server public folder, or from one Personal Folders (.pst) file to another .pst file. Solutions should not depend on the EntryID property to be unique unless items will not be moved.

    Monday, June 30, 2014 9:04 AM