Try this
using Filenet.Api.Core;
using Filenet.Api.Util;
// Assuming you have a reference to your ObjectStore
ObjectStore objectStore = ...;
// Specify the search criteria
string caseNumValue = "111";
string folderName = "Folder1";
// Construct the search query
string searchQuery = "SELECT * FROM Document WHERE CaseNum = '" + caseNumValue + "' AND This INFOLDER '" + folderName + "'";
// Create a SearchSQL object
SearchSQL searchSQL = new SearchSQL();
searchSQL.SetQueryString(searchQuery);
// Create a SearchScope to specify the search scope (e.g., the root folder)
SearchScope searchScope = new SearchScope(objectStore);
// Execute the search
RepositoryRowSet rowSet = searchScope.FetchRows(searchSQL, null, null, false);
// Process the search results
foreach (RepositoryRow row in rowSet)
{
// Access the document properties or perform other actions
Document document = (Document)row.GetObject();
// Process the document as needed
}
Source: https://data-encoder.com/
------------------------------
Zimba toki
------------------------------
Original Message:
Sent: Mon December 18, 2023 08:34 PM
From: Walter Fu
Subject: Use filenet.api.dll to search for documents filed under a folder
I have a few folders, each with a lot of documents. For illustration, these are the example documents and folders:
Doc1 - CaseNum: 111; Folder: Folder1
Doc2 - CaseNum: 222; Folder: Folder1
Doc3 - CaseNum: 111; Folder: Folder2
I would like to search for documents filed in a folder using filenet.api.dll. In the above example, I was able to search for CaseNum of 111 and find Doc1 in Folder1 and Doc3 in Folder2. What I want is to search Folder1 for documents whose CaseNum value is 111. I tried to use SearchScope and SearchSQL. I was able to specify just the CaseNum in the where clause, but could not find a way to specify a folder. I don't want to search for CaseNum and manually filter for Folder1, because that will throw away a lot of search results. Any suggestions how to search for both CaseNum and folder?
Thanks,
Walter