VSTO Add-In For Outlook problem on deploy RRS feed

  • Question

  • I developed an add-in for ms-outlook (2013 - 2019)
    in my machine the vsto working good as expected (with full setup of office)
    but few of other machines getting an error on commands (in the ribbon)
    that using reference Microsoft.Office.Interop.Outlook.
    the error is on setting Microsoft.Office.Interop.Outlook.Action as action properties...
    the error is : "Object reference is not set to an instance of an object"
    I did some tests on few machines *64 *32 and also windows 7/8/10
    Also Removed the office from my machine and install it from office 365 account and suddenly the problem also in my machine !
    what I've been encounter is, when I do full install of office there isn't any problem ! the problem, as I believe that most office users install the office as "click to run application" from office 365 accounts
    which maybe missing the reference "Microsoft.Office.Interop.Outlook" on deploy.

    My question is where to refer all users to install the full reference which is missing on "click to run application" ?
    have seen many suggestion on web and Stack Overflow but nothing solve the problem


    The code:

    var oApp = new Application();
    if (oApp.ActiveExplorer().Selection.Count > 0)
        Object selObject = oApp.ActiveExplorer().Selection[1];
        if (selObject is MailItem)
            MailItem mailItem = (selObject as MailItem);
            Actions actions = mailItem.Actions;
            Microsoft.Office.Interop.Outlook.Action action = actions["Reply"];
            action.ReplyStyle = OlActionReplyStyle.olIncludeOriginalText;  // >> Problem is here <<
            _MailItem response = action.Execute() as MailItem;

    Friday, March 6, 2020 7:50 AM