Hello Techies--
Can anyone explain why I am getting the error message: "Specific Cast is not valid" ? I realize that I'm returning an IManFolder instead of an IManDocumentFolder based running this through debug--but-- I really don't understand why exactly. Here is the snippet that fails--more specifically, here is the line that fails:
IManDocumentFolder checkFolder = (IManDocumentFolder)allFolders.ItemByIndex(i); //I thought allFolders had ONLY DocumentFolders? It doesn't??
*sigh* Help!!
Warm regards,
--p
-------------------------------------- CODE SNIPPET-------------------------------------------------------------------
private IManDocuments BringBackAllDocs(IManSession user_session,string doc_type,string doc_status)
{
IManWorkspace specificWS = null;
IManDocumentFolder specificDF = null;
IManDocuments docsWanted = null;
try
{
IManDatabase oDB = user_session.PreferredDatabase;
foreach(IManWorkspace oWorkspace in oDB.Session.WorkArea.RecentWorkspaces)
{
specificWS = (IManWorkspace)oWorkspace;
Console.WriteLine("Workspace name: " + specificWS.Name + "\n");
} // end of cycling through all recent workspaces
//Return Folder back to calling program.
IManDocumentFolders allFolders = specificWS.DocumentFolders; // folders in WS.
for(int i = 1; i < allFolders.Count; i++)
{
IManDocumentFolder checkFolder = (IManDocumentFolder)allFolders.ItemByIndex(i);
Console.WriteLine("Specific Document Folder: " + checkFolder.Name + "\n");
specificDF = (IManDocumentFolder)checkFolder;
}
}
catch(Exception error)
{
Utility.ReportErrors(error);
}
return docsWanted;
}
Paula DiTallo - Middleware Architect/ .NET Developer
plditallo@metro-design-dev.com