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)
Item "Locale" does not exist in collection
sideline
am using the Search command
when i hit the cancel button or close the form - get Exception with message of "Item 'Locale' does not exist in collection
This occurs in the line
searchresults = (IManage.IManDocuments)context.Item("SearchedNRTDocuments");
any ideas on how i can trap this ??
(apart from catching the exception ??)
*** CODE EXTRACT ***
IManage.IManDocuments searchresults;
IManage.IManProfileSearchParameters searchparams;
IManage.IManDMS dms = new IManage.ManDMSClass();
IManage.IManSession sess = dms.Sessions.Add("999.999.999.9");
sess.Login("testuser1","testuser1");
SearchCmd scmd = new SearchCmdClass();
ContextItems context = new ContextItemsClass();
context.Add("ParentWindow", this.Handle.ToInt32());
context.Add("NRTDMS", dms);
context.Add("SelectedIManSession", sess);
scmd.Initialize(context);
scmd.Update();
if (scmd.Status == (int)CommandStatus.nrActiveCommand)
{
scmd.Execute();
searchresults = (IManage.IManDocuments)context.Item("SearchedNRTDocuments");
searchparams = (IManage.IManProfileSearchParameters)context.Item("IManSearchParameters");
// Show results in a doc grid.
IIntegrationDlg.DocOpenDlg dlg = new IIntegrationDlg.DocOpenDlgClass();
// Set properties on dialog object
dlg.NRTDMS = dms;
dlg.SingleSel = false;
dlg.ShowContainedDocuments = searchparams;
etc
.........
etc
Find more posts tagged with
Comments
jny
The ContextItem, "IManExt.Refresh", returns a Boolean value after the command has been executed. It returns False if the command was not successfully executed; thus you may use that to gracefully skip the code that queries for the search results and parameters which are only available if the search was executed. Like so:
if (scmd.Status == (int)CommandStatus.nrActiveCommand)
{
scmd.Execute();
bool brefresh = (bool)context.Item("IManExt.Refresh");
if (brefresh == true)
{
searchresults = (IManage.IManDocuments)context.Item("SearchedNRTDocuments");
searchparams = (IManage.IManProfileSearchParameters)context.Item("IManSearchParameters");
}
}
sideline
thx
worked a treat
m
sideline
thx
that worked perfectly
but
.................
have got the same problem with the SaveEmailCmd
and the boolean refresh doesnt appear to catch the Cancel / close ??
icmd = new IMANEXTLib.SaveEmailCmd();
iContext = new ContextItemsClass();
iContext.Add ("NRTDMS", Login.DMS);
iContext.Add ("ParentWindow", this.Handle.ToInt32());
iContext.Add ("IManExt.SaveEmailCmd.BrowseLocation", true);
iContext.Add ("IManExt.SaveEmailCmd.EmailMsgFile", sImportpath);
icmd.Initialize(iContext);
icmd.Update();
if (icmd.Status == icmd.Status && icmd.Status == (int)CommandStatus.nrActiveCommand)
{
icmd.Execute();
if ((Boolean) iContext.Item("IManExt.Refresh"))
{
Code get here even if I press Cancel or close the form ??
jny
That could be a bug; IManExt.Refresh should return false in this case.
The ContextItems collection returns a "ImportedDocument" contextitem, which holds a handle to the imported document object, when the file is saved successfully; thus you could set up a try/catch around the code that queries for the document object to differentiate a successful execution from a failed one.