Share via


IManagedAddin Interface

Implement the IManagedAddin interface to create a component that loads managed add-ins. This interface was added in the 2007 Microsoft Office system.

[
    object,
    uuid(B9CEAB65-331C-4713-8410-DDDAF8EC191A),
    pointer_default(unique),
    oleautomation
]
interface IManagedAddin : IUnknown
{
    HRESULT Load(
        [in] BSTR bstrManifestURL, 
        [in] IDispatch *pdispApplication);
    HRESULT Unload();
};

Methods

The following table lists the methods that are defined by the IManagedAddin interface.

Name

Description

IManagedAddin::Load

Called when a Microsoft Office application loads a managed add-in.

IManagedAddin::Unload

Called just before a Microsoft Office application unloads a managed add-in.

Remarks

Microsoft Office applications, starting with the 2007 Microsoft Office system, use the IManagedAddin interface to help load Office add-ins. You can implement the IManagedAddin interface to create your own add-in loader and runtime for managed add-ins, instead of using the add-in loader (VSTOLoader.dll) and Visual Studio Tools for Office runtime. For more information, see Architecture of Application-Level Add-Ins.

How Managed Add-ins Are Loaded

The following steps occur when an application starts:

  1. The application discovers add-ins by looking for entries under the following registry key:

    HKEY_CURRENT_USER\Software\Microsoft\Office\<application name>\Addins\

    Each entry under this registry key is a unique ID of the add-in. Typically, this is the name of the add-in assembly.

  2. The application looks for a Manifest entry under the entry for each add-in.

    Managed add-ins can store the full path of a manifest in the Manifest entry under HKEY_CURRENT_USER\Software\Microsoft\Office\<application name>\Addins\<add-in ID>. A manifest is a file (typically, an XML file) that provides information that is used to help load the add-in.

  3. If the application finds a Manifest entry, the application tries to load a managed add-in loader component. The application does this by trying to create a COM object that implements the IManagedAddin interface.

    The Visual Studio Tools for Office runtime includes an add-in loader component (VSTOLoader.dll), or you can create your own by implementing the IManagedAddin interface.

  4. The application calls the IManagedAddin::Load method and passes in the value of the Manifest entry.

  5. The IManagedAddin::Load method performs tasks required to load the add-in, such as configuring the application domain and security policy for the add-in that is being loaded.

For more information about the registry keys that Microsoft Office applications use to discover and load managed add-ins, see Registry Entries for Application-Level Add-Ins.

Guidance for Implementing IManagedAddin

If you implement IManagedAddin, you must register the DLL that contains the implementation by using the following CLSID:

99D651D7-5F7C-470E-8A3B-774D5D9536AC

Microsoft Office applications use this CLSID to create the COM object that implements IManagedAddin.

Warning

This CLSID is also used by VSTOLoader.dll in the Visual Studio Tools for Office runtime. Therefore, if you use IManagedAddin to create your own add-in loader and runtime component, you cannot deploy your component to computers that are running add-ins that rely on the Visual Studio Tools for Office runtime.

See Also

Other Resources

Unmanaged API Reference (Office Development in Visual Studio)