简体   繁体   中英

Create an Outlook plugin using VS Express Edition

So I am able to launch my addin by adding this to the "ThisOutlookSession" "macro". But I get a security warning every time I open Outlook and I can't deploy this to other users.

Private instance As New MyLib.Program

Private Sub Application_Startup()

    instance.Create Application

End Sub

Private Sub Application_Quit()

    instance.Kill
    Set instance = Nothing

End Sub

With this in my C# class library project:

namespace MyLib
{
    [ComVisible(true)]
    public class Program
    {
        public void Create (object app)
        {
            var outlook = app as Microsoft.Office.Interop.Outlook.Application;
        }

        public void Kill ()
        {}
    }
}

So my question is, how can I create an Outlook plugin that doesn't get a security warning and allows easy "deploy-ability".

As you can see from the code, I need the plugin to launch whenever Outlook does.

Do not create a new instance of the Outlook.Application object. Use the instance passed to you on startup. More than that, if you are processing the Application.Startup event, you already have a pointer to the Application object, what do you need a new one for?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM