I'm trying to get iManage Word Add-in object using the following code
using Com.iManage.WorkSiteAddinInterfaces;
public void ManageIManageWordAddIn()
{
iManageExtensibility iManageAddinObj = null;
(COMAddIn addin in Globals.ThisAddIn.Application.COMAddIns)
{
string iManage2007orLater = "WorkSiteOffice2007Addins.Connect"
if (addin.ProgId.Contains(iManage2007orLater))
{
// If addin is connected, try to hijack the DocumentClose2 event
if (addin.Connect)
{
iManageAddinObj = addin.Object as iManageExtensibility; //addin.Object is null
// register to iManageAddinObj events here
iManageAddinObj.DocumentBeforeClose2 += IManageAddinObj_DocumentBeforeClose2;
}
}
}
}
private void IManageAddinObj_DocumentBeforeClose2(object Doc, ref bool IgnoreIManageClose, ref bool Cancel)
{
IgnoreIManageClose = true;
Cancel = true;
}
The add-in is connected but the addin.Object always returns null.
COMAddin.Object
property is not the COM object that implements IDTExtensibility2
etc interface. The addin can potentially expose some object that it explicitly wants to expose. If not, it will be null.