Get MatterID from iManage/Worksite doc within MS Word

535 Views Asked by At

I'm trying to retrieve the MatterId entered by the user when they saved the document in MS Word.

My code is running from with a MS Word Add-in.

I'm starting with the following code:

dynamic service = doc.Application.COMAddIns.Find(Addin).Object;
dynamic document = service.GetDocumentFromPath(doc.FullName);
return document.MatterId;

Can anyone assist with this? and also point me towards the documentation. i'm finding the various versions a bit confusing.

1

There are 1 best solutions below

2
On

Got it. Here's the code in case anyone else struggles with the same thing. Not sure why I couldn't reference the assemblies..

//var service = (iManageExtensibility)doc.Application.COMAddIns.Find(Addin).Object;
//var document = (NRTDocument)service.GetDocumentFromPath(doc.FullName);
dynamic service = doc.Application.COMAddIns.Find(Addin).Object;
dynamic document = service.GetDocumentFromPath(doc.FullName);
foreach (dynamic attribute in document.CustomAttributes)
    if (attribute.Type == 26) // AttributeID.nrCustom2
        return attribute.Name;