using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using IManage;namespace TestCreateWorkspace{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { ManDMS dms = new ManDMS(); IManSession mySession = dms.Sessions.Add("192.168.11.129"); IManDatabase ContentDb = null; IManWorkspace newWorkspace = null; IManDocumentFolder newDocFolder = null; try { mySession.Login("wsadmin", "wsadmin"); ContentDb = mySession.Databases.ItemByName("LEGAL"); newWorkspace = ContentDb.CreateWorkspace(); newWorkspace.Name = "refiling fault " + DateTime.Now.ToShortTimeString(); newWorkspace.Description = "refiling fault " + DateTime.Now.ToShortTimeString(); newWorkspace.SetAttributeByID(imProfileAttributeID.imProfileCustom16, "our client name"); newWorkspace.SubType = "work"; newWorkspace.Security.DefaultVisibility = imSecurityType.imPublic; string filePath = System.IO.Path.GetTempFileName(); IManProfileUpdateResult updateResult = newWorkspace.UpdateAllWithResults(filePath); IManDocumentFolders targetDocSubfolders = (IManDocumentFolders)newWorkspace.SubFolders; newDocFolder = targetDocSubfolders.AddNewDocumentFolderInheriting("doc folder", "description here"); newDocFolder.AdditionalProperties.Add("IMan___27", "12345"); newDocFolder.Update(); string tempFile = System.IO.Path.GetTempFileName(); IManProfileUpdateResult updRes = newWorkspace.UpdateAllWithResults(tempFile); if (updRes.Succeeded == true) MessageBox.Show("update succeeded, result in " + tempFile); else { foreach(IManProfileError pe in updRes.ErrorList) MessageBox.Show(pe.Description + "\n" + tempFile); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } if (mySession.Connected) mySession.Logout(); MessageBox.Show("done"); } }}