Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Folder searches in context of a workspace
neilm
WorkSite 8
Sorry folks I'm being really thick but I can't see how to search for a folder within the context of a WorkSpace.
I can find a Workspace (e.g. name=Client001) using the SearchWorkspaces method on IManSession.
I can also find folders (e.g. name=Matter001) using SearchProfiledFolders method on IManArea but this returns all folders with the matching name which may be in any WorkSpace (e.g Client001, Client002 and Client003) when all I want is the matching folders in the Client001 workspace.
I sort of expected something an approprate attribute in the imProfileAttributeID but can;t for the life of me see anything.
Thanks in advance
Neil M
Find more posts tagged with
Comments
jny
A DocumentFolder's default profile info is stored in the AdditionalProperties collection, so you cannot search for folders using SearchProfiledFolders. ProfiledFolder actually means a folder object that has an IManProfile associated with it to store its attributes. Currently, only a workspace is this type of folder object; thus you may only search for workspaces using SearchProfileFolders (or alternatively using SearchWorkspaces).
If you want to search for folders by a custom field value, specifically under a specified workspace, you would need to query for the custom field value in the folder's AddtionalProperties collection. This implies iterating the folder collection that is returned by IManWorkspace.DocumentFolders. Like so:
[C#]
IManDMS oDMS = new ManDMSClass();
IManSession oSess = oDMS.Sessions.Add("ntdevsupport");
oSess.TrustedLogin();
ManStrings oList = new ManStringsClass();
oList.Add (oSess.PreferredDatabase.Name);
IManWorkspaceSearchParameters oWParms = oDMS.CreateWorkspaceSearchParameters();
IManProfileSearchParameters oParms = oDMS.CreateProfileSearchParameters();
// Search for workspaces by Client, e.g., CUSTOM1="5679".
oParms.Add(imProfileAttributeID.imProfileCustom1, "5679");
// Search workspaces
IManFolders oWorkspaces = oSess.SearchWorkspaces(oList, oParms, oWParms);
// Check result set
if (oWorkspaces.Empty == false)
{
// Assuming the first item in the result set is the target workspace
IManWorkspace oWorkspace = (IManWorkspace) oWorkspaces.ItemByIndex(1);
// Search for folders belonging to the workspace by Matter, e.g., CUSTOM2="91003"
IManDocumentFolders oFolders = oWorkspace.DocumentFolders;
if (oFolders.Empty == false)
{
for(int i=1; i<=oFolders.Count; i++)
{
// Check the individual folder
IManFolder oFldr = oFolders.ItemByIndex(i);
// Check the AdditionalProperties Collection belonging to the folder
IManAdditionalProperties oAPs = oFldr.AdditionalProperties;
// Check for Custom2 AdditionalProperty
if(oAPs.ContainsByName("IMan___26")) // IMan___26 represents CUSTOM2
{
MessageBox.Show(oAPs.ItemByName("IMan___26").Value);
Environment.Exit(0);
}
}
}
}
this.Close();