我有 6.6 版的 Documentum Developer。我想在 C# 中使用 DFC 获取文档内容(将内容读入流中)。我使用了以下 C#.net 代码
IDfId id = collection.getId("r_object_id");
IDfDocument doc = (IDfDocument) session.getObject(id);
但它抛出以下异常。
Exception: Unable to cast COM object of type 'System.__ComObject' to interface type 'DFCLib.IDfDocument'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{EFAC2D68-175B-11D2-9927-006097C27C31}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
我也试过下面的方法(它运行成功)但我不知道如何将内容读入流或内存流。
IDfId id = collection.getId("r_object_id");
IDfSysObject sysObject = (IDfSysObject) session.getObject(id);
最佳答案
这会将文件转储到本地文件系统路径:
IDfId id = collection.getId("r_object_id");
IDfSysObject sysObject = (IDfSysObject) session.getObject(id);
sysObject.getFile(<path>)
然后您可以使用标准 .Net IO 库将文件作为流打开,例如:
var stream = new System.IO.StreamReader(<path>)
我相信 DFC 有一些基于流的公共(public)方法(getContent?),但我还没有看到它们在 .Net 中成功使用。但是,我建议您查看 DFS(Documentum Foundation Services)API 而不是 DFC。这是现在受支持的 API,DFC 作为公共(public) API 已弃用。 DFS 在处理存储库内容时确实有流选项。
您可能还想查看 http://developer.emc.com如果此答案不足以满足您的需求。
关于c# - 如何在c#中使用DFC获取文档内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12330910/