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)
Creating Workspaces from Code
MikeatBDB
Hi all
I have written a command line utility to to bulk modifications to workspaces including adding folders and populating then with copies of documents. This all works perfectly.
However we occasionally come acrossing missing workspaces when running thorugh this process and so we would like to create a workspace in this instance. I have looked at the documentation and it refers to CreatePage call when using the IManage objects but this does not exist.
I have written the following code but when I try to run the line oWS.Update it fails with the error [Folders ][Update ]Object is not a valid page. Have I missed something?
Thanks
Mike
CODE:
private IManWorkspace CreateWorkspace(IManDatabase oD, string strMatterId, string strClientId, string strDept,
string strCategory, string strTitle, string strDescription, string strOwner)
{
IManWorkspace oWS = oD.CreateWorkspace();
oWS.SetAttributeByID(IManage.imProfileAttributeID.imProfileCustom1, strClientId);
oWS.SetAttributeByID(IManage.imProfileAttributeID.imProfileCustom2, strMatterId);
oWS.SetAttributeByID(IManage.imProfileAttributeID.imProfileLocation, strDept);
if(strCategory != "")
{
oWS.SetAttributeByID(IManage.imProfileAttributeID.imProfileSubClass, strCategory);
}
if (strOwner != "")
{
IManUser oU = oD.GetUser(strOwner);
oWS.Owner = oU;
}
oWS.Name = strTitle;
oWS.Description = strDescription;
oWS.Update();
return oWS;
}
Find more posts tagged with
Comments
jny
To create a user workspace, you must have these required fields before calling Update. The correct update call is the UpdateAllWithResults(filePath) method. The filePath in the argument can be a system temp path.
[C#]
// *******************************************
// Create a new user workspace
// *******************************************
// Create a workspace in the selected database.
IManWorkspace myWorkspace = myDatabase.CreateWorkspace();
// Populate required profile fields for the workspace.
myWorkspace.Name = "MY PAGE";
myWorkspace.Description = "Demonstrate creating a new workspace using the iManage Type Library.";
myWorkspace.SubType = "work";
myWorkspace.Security.DefaultVisibility = imSecurityType.imPublic;
// Commit the workspace to the database.
string filePath = Path.GetTempFileName();
IManProfileUpdateResult updateResult = myWorkspace.UpdateAllWithResults(filePath);
if (updateResult.Succeeded == true)
{
MessageBox.Show("Succeeded in creating a new workspace: " + myWorkspace.ID);
}
MikeatBDB
Regards
Mike