2016-06-28 30 views
0

我試圖檢索用戶在MS Word中保存文檔時輸入的MatterId。從MS Word中的iManage/Worksite doc獲取MatterID

我的代碼從MS Word加載項運行。

我開始用下面的代碼:

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

任何人都可以幫助嗎?並指出我的文件。我發現各種版本有點混亂。

回答

0

明白了。這是代碼,以防其他人在同一件事上掙扎。不知道爲什麼我不能引用組件..

//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; 
+0

只是爲了澄清答案,此事ID暴露上,而不是像MatterId明確指定的屬性IManDocument類的自定義屬性。在這種情況下,Custom2。您應該能夠使用enum imProfileAttributeID.imProfileCustom2在document.CustomAttributes中引用此屬性。 –

+0

有關詳細信息,請參閱作爲IManage SDK一部分提供的WorkSite COM開發人員參考指南(8.5,英語).pdf文件。這是您需要許可的商用SDK,因此您應該與IManage合作伙伴談論如何訪問它。 –