开发者

How can I programatically tell what Outlook addins are installed, and if they are enabled or not?

How do I determine what Outlook COM or 开发者_开发问答PIA addins are installed, and if they are enabled or not.

How can I get this information, and hopefully the file version as well?


(1) If you want to access this information from inside another Outlook Add-in, you may use the the Application.ComAddins object (e.g. it's Count property gives you the number of add-ins installed). You can loop through this collection and check the LoadBehaviour property of the single COMAddin object to now if they're loading or if they're disabled.

(2) If you wand to access the information from outside of Outlook, you may consider to read the appropriate registry entries under the Software\Microsoft\Office\Outlook\Addins key.

(3) Please be aware that you cannot trust this information at all, because Office add-ins can be installed either for a single user or for all users. So you cannot access the installed add-ins absolutely, but only for the current user running your app /your procedure, by reading the abovementioned key (a) under HKLM and (b) under HKCU. The Application.COMAddins object shows you both information blended in one.

(4) I don't recall that a version number is available either in the COMAddin object or in the registry. To access that, you'll have to read the registry to find the file or assembly of the add-in, and access the file version. Please note that "old" COM Add-ins written in Visual Basic 6 or another language have other registry entries than VSTO add-ins or add-ins based on the Add-in Express tool.


To determine which installed add-ins are active (enabled/loaded):

'Loop through all installed add-ins and show whether they are active or not.
Dim app As New Outlook.Application
Dim name As String
Dim loaded As Boolean
For i = 1 To app.COMAddIns.Count
    name = app.COMAddIns.Item(i).Description
    loaded = app.COMAddIns.Item(i).Connect 'Returns True for active, False for inactive
    MsgBox(name & ": " & loaded)
Next

To check the status of a specific add-in by name:

Dim app As New Outlook.Application
Dim addinName As String = "ADD-IN NAME"
Dim loaded As Boolean = app.COMAddIns.Item(addinName).Connect
MsgBox(addinName & ": " & loaded)


You can access that information even from outside of outlook.

    Dim count As Integer
    Dim app As New Outlook.Application

    count = app.COMAddIns.Count

    For i = 1 To count

        MsgBox(app.COMAddIns.Item(0).Description)

    Next
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜