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)
IManFileOpenCmd initial folder
DevGordon
Dear All,
Is there anyway of setting the initial folder in the IManFileOpenCmd? I wish to display the contents of the folder in the Open Dialog for the user to select a document to open.
I understand that this is set from the registry value under HKCU\Sofware\Interwoven\Worksite\8.0\IManExt\BrowseDlg\Last Location (Path). However I do not seem to be able to provide a valid path value to put into this registry value.
I need to be able to build this path to the folder I want to set, anybody got any code for performing this operation, or any information on how this Path value is built up?
Or if anybody has another solution, any help would be appreciated.
Kind regards
Gordon.
Find more posts tagged with
Comments
jny
You may certainly try writing to this key before executing your IManFileOpenCmd to see if that will work correctly for you.
Please note that if another instance of a dialog, i.e., SaveAs, Open, from any other application is used for the end-user to select a location, the value you added will get overwritten by the last used dialog. So you would always need to write to this key before execution of your IManFileOpenCmd Object.
Here's a code snippet to demonstrate building the last location path to a folder under a workspace:
[C#]
// Constants for building preselect location
const string WORKSPACE_NODE = "My Workspaces"; // or "Other Workspaces"; interchangable
const string DELIMITER = "\\"; // location path separator
// Assuming the location in the dialog to bring user to is _
// a specified folder named, FolderTestA-a, inside a _
// workspace belonging to the currently logged on user, _
// we'll search for the folder.
// (i.e.,\ServerDevelopment\DatabaseTest\My WorkSpaces\
// WorkspaceTest\TabTest\FolderTestA\FolderTestA-a)
// Create search parameters
IManFolderSearchParameters oParams = oDMS.CreateFolderSearchParameters();
// Add search criteria
oParams.Add (imFolderAttributeID.imFolderName, "FolderTestA-a");
oParams.Add (imFolderAttributeID.imFolderOwner, oSess.UserID);
// Search for folder
IManFolders oResults = oSess.WorkArea.SearchFolders(oList, oParams);
// Check oResults
if (oResults.Empty == true)
{
// Destination folder is not found; exit app.
MessageBox.Show( "folder not found.");
Environment.Exit(0);
}
// Assuming the first item is the oTarget folder
IManFolder oTarget = oResults.ItemByIndex(1);
// Path, which returns IManFolders collection representing _
// the ancestors of the IManFolder object and including _
// the folder itself, is ordered from the root to the current folder, _
// i.e., the root level folder is ItemByIndex(1).
IManFolders oPath = oTarget.Path;
// Build preselected path
string strPreSelectedLoc = string.Empty;
for(int i=1; i<=oPath.Count; i++)
{
// Concatenate the Object ID of each folder object in the oTarget's path
strPreSelectedLoc = strPreSelectedLoc + DELIMITER + oPath.ItemByIndex(i).ObjectID;
}
// The object ID's of oSession and database to which the oTarget folder belongs come first
// in the order of object ID's in the preselected path.
string sessID = oTarget.Database.Session.ObjectID;
string dbID = oTarget.Database.ObjectID;
// Concatenate Object ID's to build preselected location
strPreSelectedLoc = DELIMITER + sessID + DELIMITER + dbID + DELIMITER + WORKSPACE_NODE + strPreSelectedLoc;