Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Search by edit date and document extension
Azan
Greetings,
I'm trying to search for documents from a database which were edited within a date range and which have an extension in a set of extensions. For example, I might be searching for all documents edited in February 2011, with extension "DOC", "XML", or "PPT".
I'm using the imanage.dll interop, and I've currently got C# code derived from the docs that search the date range. How can I add search parameters to limit the extension?
_ManDMS = new ManDMS();
_ManSession = _ManDMS.Sessions.Add(server);
_ManSession.Login(username, password);
_ManDatabase = _ManSession.PreferredDatabase;
IManProfileSearchParameters searchParameters = _ManDMS.CreateProfileSearchParameters();
IManDateRange dateRange = _ManDMS.CreateDateRange();
dateRange.DateRangeType = imDateRangeType.imAbsoluteDateRangeType;
dateRange.AbsoluteStartDate.Value = start;
dateRange.AbsoluteEndDate.Value = end;
searchParameters.Add(imProfileAttributeID.imProfileEditDate, dateRange.Value);
IManDocuments documents = _ManDatabase.SearchDocuments(searchParameters, true) as IManDocuments;
Thanks in advance.
Find more posts tagged with
Comments
mlf
If you have the SDK look in the "WorkSite COM Developers Reference Guide" under the "Complex Searching" section on page 58.
If you don't have the SDK here is an example that looks like it will suit your needs.
Example A – Search Query: (MATTER="00005") AND (CLIENT="5679" OR CLIENT="9102")
private void ExampleA(IManSession sess, ManStrings dblist)
{
// Search Query: (MATTER="00005") AND (CLIENT="5679" OR
//CLIENT="9102")
// Create OrQuery
IManAndQuery andQuery = new ManAndQueryClass();
// Use AddFieldQuery to create an Or query (MATTER="00005")
IManFieldQuery andQueryField = _
andQuery.AddFieldQuery(imProfileAttributeID.imProfileCustom2);
// Matter attribute
andQueryField.Values.Add("00005");
// Use AddFieldQuery to build an Or subquery between values of the
// same attribute ID (CLIENT="5679" OR CLIENT="9102")
IManFieldQuery oqC1 = _
andQuery.AddFieldQuery(imProfileAttributeID.imProfileCustom1);
// Client attribute
oqC1.Values.Add("5679");
oqC1.Values.Add("9102");
try
{
string strResults= string.Empty;
int ct=0;
// Pass in the ManAndQuery parameter to run the search
IManDocuments results = _
(IManDocuments)sess.WorkArea.SearchDocumentsEx(dblist, _
andQuery);
if (results.Empty == false)
{
ct = results.Count;
for(int i=1; i<=(results.Count); i++)
{
IManDocument item = (IManDocument)results.ItemByIndex(i);
strResults = strResults + "Docnum = " + item.Number + "_" +
item.Version + ", client = " +
item.GetAttributeValueByID(imProfileAttributeID.imProfileCustom1)+ ", matter = " + item.GetAttributeValueByID(imProfileAttributeID.imProfileCustom2) + Environment.NewLine;
}
}
MessageBox.Show("Example A: returned " + ct.ToString() + _
Environment.NewLine + strResults);
}
}