在 iManage (worksite) 中查询文档



我正在使用Worksite API在iManage(版本8.5)中查询文档。 我在下面列出了我的代码。 如果我只使用一个搜索参数,那么代码可以毫无问题地工作。但是,如果我添加多个参数,那么它要么返回 null 要么返回没有结果(结果。计数 = 0)

然后我更改了我的代码以使用 ManOrQuery 类(由我的 Worksite API 提供,请参阅注释行),但这仍然不起作用。

// Search for documents matching the specified date range.
iManageSearch rds = new iManageSearch(isession);
// Populate searchparameters
IManProfileSearchParameters searchparams = Utility.CreateUnpopulatedProfileParams(idms);
//searchparams.Add(imProfileAttributeID.imProfileCreateDate, dateRange.Value);
//searchparams.Add(imProfileAttributeID.imProfileAuthor, srchKey);
//searchparams.Add(imProfileAttributeID.imProfileFullText, srchKey);
searchparams.Add(imProfileAttributeID.imProfileDocNum, srchKey);
//searchparams.Add(imProfileAttributeID.imProfileDescription, srchKey);
// Search documents
IManDocuments results = rds.GetDocuments(Utility.BuildDatabaseList(isession.Databases), searchparams);
// tried the other way to search document

//QueryBuilder qb = new QueryBuilder();
//ManOrQuery orquery = qb.CreateORQuery;
//qb.AddORSearchFieldValue(orquery, imProfileAttributeID.imProfileDocNum, srchKey);
//qb.AddORSearchFieldValue(orquery, imProfileAttributeID.imProfileAuthor, srchKey);
//qb.AddORSearchFieldValue(orquery, imProfileAttributeID.imProfileFullText, srchKey);
//IManContents results = qb.GetContents(iworkarea, Utility.BuildDatabaseList(isession.Databases), (IManQuery)orquery);
int c = results.Count;

在我的 UI 上,我有一个文本框供用户输入其搜索凭据。我想将搜索值与AuthorDocNumberDocTitle以及文档的内容进行比较。我的目标是构建一个像(docAuthor=srchKey OR docNum=srchKey OR docDescription = srchKey ...)这样的查询。 我一直在敲头,希望有人能帮助我。 谢谢。

PS:我还提到了一篇文章 如何从iManage/Desksite获取信息,但这对我不起作用....

我知道这个问题

发布已经有一段时间了,我已经在stackoverflow周围做了一些搜索,但找不到太多可以帮助我解决这个问题的方法,但是我已经设法编写了一些有效的代码(至少对我来说),我希望如果为时已晚,无法帮助您, 它可能会帮助其他人。

我看不到您在上面的代码中如何设置数据库,因此可能存在问题 - 因为添加搜索参数的语法似乎是正确的。

更新:我已经与我们的管理员交谈过,似乎要进行搜索,这取决于服务器的索引器设置。这可能是您的代码无法正常工作的原因。对我来说,我必须从工作区服务管理器中的数据库属性中禁用索引器,以便它使用 SQL

            IManDMS dms = (IManDMS)Activator.CreateInstance(Type.GetTypeFromProgID("iManage.ManDMS"));
            IManSession session = dms.Sessions.Add(serverName);
            session.TrustedLogin2(userToken);
            IManDatabase database = session.Databases.ItemByName(libraryName);
            IManProfileSearchParameters searchparameters = dms.CreateProfileSearchParameters();
            // add search parameters            
            // this works (just to prove that we can search for a document)                
            searchparameters.Add(imProfileAttributeID.imProfileDocNum, "4882408");
            searchparameters.Add(imProfileAttributeID.imProfileCreateDate, new DateTime(2015, 04, 8).ToShortDateString());           
            // run the search
            IManContents searchResults = database.SearchDocuments(searchparameters, true);
            // process the results
            foreach (IManDocument item in ((IEnumerable)searchResults).OfType<IManDocument>())
            {   
                // do something with the document
            }
            session.Logout();
            dms.Sessions.RemoveByObject(session);

最新更新