我使用Worksite在iManage (V8.5版)中查询文档。下面列出了我的代码。如果我只使用一个搜索参数,那么代码可以正常工作,没有任何问题。但是,如果我添加了多个参数,那么它将返回null或无结果(result.Count = 0)。
然后,我将代码更改为使用ManOrQuery类(由我的Worksite提供,请参见注释行),但仍然无法工作。
// 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中,我有一个文本框供用户输入他们的搜索凭证。我想将搜索值与Author、DocNumber、DocTitle以及文档的内容进行比较。我的目标是构建一个类似于(docAuthor=srchKey OR docNum=srchKey OR docDescription = srchKey ...)的查询。我一直在胡思乱想,希望有人能帮我。谢谢。
PS:我也提到了How to get information out of iManage / Desksite这里的一篇文章,但这对我来说不管用.
发布于 2015-05-14 08:41:10
我知道这个问题发布已经有一段时间了,我已经对堆栈溢出进行了一些搜索,在这个问题上找不到多少帮助我的地方,但是我已经成功地编写了一些代码(至少对我来说),我希望如果帮助你为时已晚,它可能会帮助其他人。
我看不出您是如何在上面的代码中设置数据库的,因此可能会出现一个问题--因为添加搜索参数的语法似乎是正确的。
更新:我已经和管理员谈过了,似乎要进行搜索,这取决于服务器的索引器设置。这可能是您的代码无法工作的原因。对我来说,我必须从WorkSite服务管理器中的数据库属性中禁用索引器,这样它才能使用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);https://stackoverflow.com/questions/29615545
复制相似问题