capture the Outlook 2013 Send event












5














I'm working on an application that should capture the Outlook 2013 Send event. I have used a C# project to do the required task.



In particular I have used following code to do this task



public Outlook.Application OutlookApplication;
public Outlook.Inspectors OutlookInspectors;
public Outlook.Inspector OutlookInspector;
public Outlook.MailItem OutlookMailItem;
public delegate void ApplicationEvents_11_ItemSendEventHandler(object Item, ref bool Cancel);

applicationObject = application;
addInInstance = addInInst;
OutlookApplication = application as Outlook.Application;
OutlookInspectors = OutlookApplication.Inspectors;
OutlookInspectors.NewInspector += new InspectorsEvents_NewInspectorEventHandler(OutlookInspectors_NewInspector);
OutlookApplication.ItemSend += new Outlook.ApplicationEvents_11_ItemSendEventHandler(OutlookMailItem_Send);

string strchkTo = OutlookMailItem.To;
string strchk = "hello Welcome to c#";

OutlookInspector = (Outlook.Inspector)Inspector;
if (Inspector.CurrentItem is Outlook.MailItem)
{
OutlookMailItem = (Outlook.MailItem)Inspector.CurrentItem;
}









share|improve this question
























  • I'm okay with that.
    – Marco A.
    Feb 7 '14 at 13:03


















5














I'm working on an application that should capture the Outlook 2013 Send event. I have used a C# project to do the required task.



In particular I have used following code to do this task



public Outlook.Application OutlookApplication;
public Outlook.Inspectors OutlookInspectors;
public Outlook.Inspector OutlookInspector;
public Outlook.MailItem OutlookMailItem;
public delegate void ApplicationEvents_11_ItemSendEventHandler(object Item, ref bool Cancel);

applicationObject = application;
addInInstance = addInInst;
OutlookApplication = application as Outlook.Application;
OutlookInspectors = OutlookApplication.Inspectors;
OutlookInspectors.NewInspector += new InspectorsEvents_NewInspectorEventHandler(OutlookInspectors_NewInspector);
OutlookApplication.ItemSend += new Outlook.ApplicationEvents_11_ItemSendEventHandler(OutlookMailItem_Send);

string strchkTo = OutlookMailItem.To;
string strchk = "hello Welcome to c#";

OutlookInspector = (Outlook.Inspector)Inspector;
if (Inspector.CurrentItem is Outlook.MailItem)
{
OutlookMailItem = (Outlook.MailItem)Inspector.CurrentItem;
}









share|improve this question
























  • I'm okay with that.
    – Marco A.
    Feb 7 '14 at 13:03
















5












5








5


3





I'm working on an application that should capture the Outlook 2013 Send event. I have used a C# project to do the required task.



In particular I have used following code to do this task



public Outlook.Application OutlookApplication;
public Outlook.Inspectors OutlookInspectors;
public Outlook.Inspector OutlookInspector;
public Outlook.MailItem OutlookMailItem;
public delegate void ApplicationEvents_11_ItemSendEventHandler(object Item, ref bool Cancel);

applicationObject = application;
addInInstance = addInInst;
OutlookApplication = application as Outlook.Application;
OutlookInspectors = OutlookApplication.Inspectors;
OutlookInspectors.NewInspector += new InspectorsEvents_NewInspectorEventHandler(OutlookInspectors_NewInspector);
OutlookApplication.ItemSend += new Outlook.ApplicationEvents_11_ItemSendEventHandler(OutlookMailItem_Send);

string strchkTo = OutlookMailItem.To;
string strchk = "hello Welcome to c#";

OutlookInspector = (Outlook.Inspector)Inspector;
if (Inspector.CurrentItem is Outlook.MailItem)
{
OutlookMailItem = (Outlook.MailItem)Inspector.CurrentItem;
}









share|improve this question















I'm working on an application that should capture the Outlook 2013 Send event. I have used a C# project to do the required task.



In particular I have used following code to do this task



public Outlook.Application OutlookApplication;
public Outlook.Inspectors OutlookInspectors;
public Outlook.Inspector OutlookInspector;
public Outlook.MailItem OutlookMailItem;
public delegate void ApplicationEvents_11_ItemSendEventHandler(object Item, ref bool Cancel);

applicationObject = application;
addInInstance = addInInst;
OutlookApplication = application as Outlook.Application;
OutlookInspectors = OutlookApplication.Inspectors;
OutlookInspectors.NewInspector += new InspectorsEvents_NewInspectorEventHandler(OutlookInspectors_NewInspector);
OutlookApplication.ItemSend += new Outlook.ApplicationEvents_11_ItemSendEventHandler(OutlookMailItem_Send);

string strchkTo = OutlookMailItem.To;
string strchk = "hello Welcome to c#";

OutlookInspector = (Outlook.Inspector)Inspector;
if (Inspector.CurrentItem is Outlook.MailItem)
{
OutlookMailItem = (Outlook.MailItem)Inspector.CurrentItem;
}






c# vsto






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 7 '14 at 13:03









Marco A.

35.2k1987190




35.2k1987190










asked Feb 7 '14 at 12:55









RameezAli

708911




708911












  • I'm okay with that.
    – Marco A.
    Feb 7 '14 at 13:03




















  • I'm okay with that.
    – Marco A.
    Feb 7 '14 at 13:03


















I'm okay with that.
– Marco A.
Feb 7 '14 at 13:03






I'm okay with that.
– Marco A.
Feb 7 '14 at 13:03














1 Answer
1






active

oldest

votes


















7














The following steps works fine at my side.




  1. Create a Shared Add In. Choose Outlook to be the supported Application.

  2. In the Application Property page, set Outlook to be the start up program.

  3. Add a reference to Microsoft Outlook 11.0 Object Library.


  4. Import the namespace:



    using Outlook = Microsoft.Office.Interop.Outlook;
    using System.Windows.Forms;




5.Replace the original system generated fields:



private object applicationObject;
private object addInInstance;


with the following new fields: (No ItemSend event)



public Outlook.Application OutlookApplication;
public Outlook.Inspectors OutlookInspectors;
public Outlook.Inspector OutlookInspector;
public Outlook.MailItem OutlookMailItem;


6.In the OnConnection method, replace all the system generated codes with the following ones:



OutlookApplication = application as Outlook.Application;
OutlookInspectors = OutlookApplication.Inspectors;
OutlookInspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(OutlookInspectors_NewInspector);
OutlookApplication.ItemSend +=new Microsoft.Office.Interop.Outlook.ApplicationEvents_11_ItemSendEventHandler(OutlookApplication_ItemSend);


7.Add the event handler function OutlookInspectors_NewInspector:



 void OutlookInspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
{
OutlookInspector = (Outlook.Inspector)Inspector;
if (Inspector.CurrentItem is Outlook.MailItem)
{
OutlookMailItem = (Outlook.MailItem)Inspector.CurrentItem;
}

}


8.Add the event handler function OutlookApplication_ItemSend:



 void OutlookApplication_ItemSend(object Item, ref bool Cancel)
{
string strchkTo = OutlookMailItem.To;
string strchk = "hello Welcome to c#";
MessageBox.Show(strchk + "rn" + strchkTo);
}





share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f21628357%2fcapture-the-outlook-2013-send-event%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    7














    The following steps works fine at my side.




    1. Create a Shared Add In. Choose Outlook to be the supported Application.

    2. In the Application Property page, set Outlook to be the start up program.

    3. Add a reference to Microsoft Outlook 11.0 Object Library.


    4. Import the namespace:



      using Outlook = Microsoft.Office.Interop.Outlook;
      using System.Windows.Forms;




    5.Replace the original system generated fields:



    private object applicationObject;
    private object addInInstance;


    with the following new fields: (No ItemSend event)



    public Outlook.Application OutlookApplication;
    public Outlook.Inspectors OutlookInspectors;
    public Outlook.Inspector OutlookInspector;
    public Outlook.MailItem OutlookMailItem;


    6.In the OnConnection method, replace all the system generated codes with the following ones:



    OutlookApplication = application as Outlook.Application;
    OutlookInspectors = OutlookApplication.Inspectors;
    OutlookInspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(OutlookInspectors_NewInspector);
    OutlookApplication.ItemSend +=new Microsoft.Office.Interop.Outlook.ApplicationEvents_11_ItemSendEventHandler(OutlookApplication_ItemSend);


    7.Add the event handler function OutlookInspectors_NewInspector:



     void OutlookInspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
    {
    OutlookInspector = (Outlook.Inspector)Inspector;
    if (Inspector.CurrentItem is Outlook.MailItem)
    {
    OutlookMailItem = (Outlook.MailItem)Inspector.CurrentItem;
    }

    }


    8.Add the event handler function OutlookApplication_ItemSend:



     void OutlookApplication_ItemSend(object Item, ref bool Cancel)
    {
    string strchkTo = OutlookMailItem.To;
    string strchk = "hello Welcome to c#";
    MessageBox.Show(strchk + "rn" + strchkTo);
    }





    share|improve this answer




























      7














      The following steps works fine at my side.




      1. Create a Shared Add In. Choose Outlook to be the supported Application.

      2. In the Application Property page, set Outlook to be the start up program.

      3. Add a reference to Microsoft Outlook 11.0 Object Library.


      4. Import the namespace:



        using Outlook = Microsoft.Office.Interop.Outlook;
        using System.Windows.Forms;




      5.Replace the original system generated fields:



      private object applicationObject;
      private object addInInstance;


      with the following new fields: (No ItemSend event)



      public Outlook.Application OutlookApplication;
      public Outlook.Inspectors OutlookInspectors;
      public Outlook.Inspector OutlookInspector;
      public Outlook.MailItem OutlookMailItem;


      6.In the OnConnection method, replace all the system generated codes with the following ones:



      OutlookApplication = application as Outlook.Application;
      OutlookInspectors = OutlookApplication.Inspectors;
      OutlookInspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(OutlookInspectors_NewInspector);
      OutlookApplication.ItemSend +=new Microsoft.Office.Interop.Outlook.ApplicationEvents_11_ItemSendEventHandler(OutlookApplication_ItemSend);


      7.Add the event handler function OutlookInspectors_NewInspector:



       void OutlookInspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
      {
      OutlookInspector = (Outlook.Inspector)Inspector;
      if (Inspector.CurrentItem is Outlook.MailItem)
      {
      OutlookMailItem = (Outlook.MailItem)Inspector.CurrentItem;
      }

      }


      8.Add the event handler function OutlookApplication_ItemSend:



       void OutlookApplication_ItemSend(object Item, ref bool Cancel)
      {
      string strchkTo = OutlookMailItem.To;
      string strchk = "hello Welcome to c#";
      MessageBox.Show(strchk + "rn" + strchkTo);
      }





      share|improve this answer


























        7












        7








        7






        The following steps works fine at my side.




        1. Create a Shared Add In. Choose Outlook to be the supported Application.

        2. In the Application Property page, set Outlook to be the start up program.

        3. Add a reference to Microsoft Outlook 11.0 Object Library.


        4. Import the namespace:



          using Outlook = Microsoft.Office.Interop.Outlook;
          using System.Windows.Forms;




        5.Replace the original system generated fields:



        private object applicationObject;
        private object addInInstance;


        with the following new fields: (No ItemSend event)



        public Outlook.Application OutlookApplication;
        public Outlook.Inspectors OutlookInspectors;
        public Outlook.Inspector OutlookInspector;
        public Outlook.MailItem OutlookMailItem;


        6.In the OnConnection method, replace all the system generated codes with the following ones:



        OutlookApplication = application as Outlook.Application;
        OutlookInspectors = OutlookApplication.Inspectors;
        OutlookInspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(OutlookInspectors_NewInspector);
        OutlookApplication.ItemSend +=new Microsoft.Office.Interop.Outlook.ApplicationEvents_11_ItemSendEventHandler(OutlookApplication_ItemSend);


        7.Add the event handler function OutlookInspectors_NewInspector:



         void OutlookInspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
        {
        OutlookInspector = (Outlook.Inspector)Inspector;
        if (Inspector.CurrentItem is Outlook.MailItem)
        {
        OutlookMailItem = (Outlook.MailItem)Inspector.CurrentItem;
        }

        }


        8.Add the event handler function OutlookApplication_ItemSend:



         void OutlookApplication_ItemSend(object Item, ref bool Cancel)
        {
        string strchkTo = OutlookMailItem.To;
        string strchk = "hello Welcome to c#";
        MessageBox.Show(strchk + "rn" + strchkTo);
        }





        share|improve this answer














        The following steps works fine at my side.




        1. Create a Shared Add In. Choose Outlook to be the supported Application.

        2. In the Application Property page, set Outlook to be the start up program.

        3. Add a reference to Microsoft Outlook 11.0 Object Library.


        4. Import the namespace:



          using Outlook = Microsoft.Office.Interop.Outlook;
          using System.Windows.Forms;




        5.Replace the original system generated fields:



        private object applicationObject;
        private object addInInstance;


        with the following new fields: (No ItemSend event)



        public Outlook.Application OutlookApplication;
        public Outlook.Inspectors OutlookInspectors;
        public Outlook.Inspector OutlookInspector;
        public Outlook.MailItem OutlookMailItem;


        6.In the OnConnection method, replace all the system generated codes with the following ones:



        OutlookApplication = application as Outlook.Application;
        OutlookInspectors = OutlookApplication.Inspectors;
        OutlookInspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(OutlookInspectors_NewInspector);
        OutlookApplication.ItemSend +=new Microsoft.Office.Interop.Outlook.ApplicationEvents_11_ItemSendEventHandler(OutlookApplication_ItemSend);


        7.Add the event handler function OutlookInspectors_NewInspector:



         void OutlookInspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
        {
        OutlookInspector = (Outlook.Inspector)Inspector;
        if (Inspector.CurrentItem is Outlook.MailItem)
        {
        OutlookMailItem = (Outlook.MailItem)Inspector.CurrentItem;
        }

        }


        8.Add the event handler function OutlookApplication_ItemSend:



         void OutlookApplication_ItemSend(object Item, ref bool Cancel)
        {
        string strchkTo = OutlookMailItem.To;
        string strchk = "hello Welcome to c#";
        MessageBox.Show(strchk + "rn" + strchkTo);
        }






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 13 '14 at 11:47









        Mike Fuchs

        9,74024159




        9,74024159










        answered Feb 7 '14 at 13:09









        Asif

        2,3861423




        2,3861423






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f21628357%2fcapture-the-outlook-2013-send-event%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Florida Star v. B. J. F.

            Danny Elfman

            Retrieve a Users Dashboard in Tumblr with R and TumblR. Oauth Issues