Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
How to create a workspace using workspace template
GBS
We need to create workspaces programatically in WorkSite 8.0 SDK, using the workspace templates.
Which object and method can provide this functionality ?
I checked the iManDatabase and iManWorkspace objects. I can create a new workspace using the iManDatabase object. But, need to know how to attach the workspace template.
Any help is greatly appreciated.
Find more posts tagged with
Comments
jny
See reply to your posted question in Developer Suite.
danielguzman
i am having the same problem and cant find where the reply to his question is. could someone direct me towards it? below is the code i have so far:
Function WorkSpaceCreate(Name As String, description As String) As IManage.IManWorkspace
Dim WorkSpace As IManage.IManWorkspace
Dim Errors As Object
''create workspace
Set WorkSpace = Session.Databases.ItemByIndex(1).CreateWorkSpace
With WorkSpace
.Name = Name
.description = description
.SubType = "Work"
.Security.DefaultVisibility = imPublic
.Security.UserACLs.Add Application.UserName, imRightAll
.UpdateAll "c:/results.txt", Errors
End With
''return workspace
Set WorkSpaceCreate = WorkSpace
End Function
jny
In 8.0 we no longer use xml template to store data. All Workspace Objects, including Workspace templates, are stored in the database. So if your workspace template is an actual xml file, such as the ones that we used in pre 8.0, then it's useless in the 8.0 world -- the iManage.dll does not respect it.
If you're, however, attempting to create workspaces based on a server stored workspace template -- a workspace object of subtype imWorkspaceTemplateSubtype -- then what you could do is:
1. Query for the workspace template object from the database:
[C#]
// Get template by GetTabWithContentsBySID
IManTabContents myTabContents = myDMS.GetTabWithContentsBySID("!nrtdms:0:!session:JYEE-PORCIE:!database
orcie:!page:126:");
IManTab myTabX = myTabContents.Tab;
IManWorkspace myTemplate = myTabX.Workspace;
// Get template by SearchWorkspaces
IManProfileSearchParameters profparms = myDMS.CreateProfileSearchParameters();
IManWorkspaceSearchParameters wsparms = myDMS.CreateWorkspaceSearchParameters();
wsparms.Add (imFolderAttributeID.imFolderName, "Create Template Test");
IManFolders myTemplates = mySession.SearchWorkspaces(myDatabaseList, profparms, wsparms);
2. Create a user workspace (which you already know how)
3. Populate the user workspace with the same objects that are stored in the workspace template.
beynen
I have the same problem...
Can you be more explicit in your sample, like giving an entire sample.
Many thanks.
jny
A complete example on how to populate the new workspace with contents is in technical article 52645. You can get to this article by selecting Tech Library, then enter the article id 52645 after clicking on Look-up by ID from the left-hand pane.
Please note that you would need to read in your template xml to get its contents to re-create them in your new workspace.
beynen
thanks for your answer.
i have two more questions...
in fact i cannot build a workspace by using a workspace template with an outlook addin ?
is it possible to add a subfolder in a subfolder by code ?
you said "Please note that you would need to read in your template xml to get its contents to re-create them in your new workspace."
how can i get my template xml ?
Thanks
Neil
an other subject ... Is it possible to clear the position of the filesite tree in outlook when i close it ? I would like that when i restart outlook, the filesite tree will be collapsed and not expanded as it was when i close outlook. When filesite tree is collapsed, the time to start outlook is short.
dabird
If you're not familiar with the object model, another option is to use the CreateWorkspaces web service that is available in WorkSite Web 8.2. All you have to do is pass the template moniker to your request and WorkSite Web will handle creating the new workspace out of the existing template workspace. Web services are documented in "WorkSite Web Application Integration Toolkit", which is available in the WorkSite Web installation package.
jny
You mean, you would like to generate workspaces off of a workspace template inside your own Outlook COM Add-In? If so, you may do so by using the SDK to login to a WorkSite session, then generate the workspaces according to the code example in the technical article.
You can add folders under another folder using the SDK.
You can get the template XML by calling the GetCopy Method of the template workspace object. (See SDK documentation for further clarification.)
If the workspace template is created in WorkSite 8.x, you should be able to go through the object contents to duplicate them for the workspace.
You may create workspaces through the Web Service method suggested by dabird, but I am not familiar with how you would call the Web Service from within your Outllook Add-In - if that is indeed what you're trying to do.
The SDK does not support collapsing the FileSite treeview at Outlook launch.
beynen
Many Thanks
You can add folders under another folder using the SDK.... how ?
theres is not sample in vb.net ?
If i understand, it is possible to create workspace by using a template with the Web services... but i cannot find any sample...
It's quiet difficult to have some sample in vb.net here...
In general...I'm quiet desesperate because there is no real SDK here, with real sample. Why cannot we search in full text in Tech Library instead of ID ?
Regards
Neil
jny
VBNet code example to add a subfolder:
======================================
Const SERVERNAME = ""
Const DATABASENAME = ""
Const USERID = ""
Const PWD = ""
Try
Dim dms As New ManDMS
Dim sess As IManSession = dms.Sessions.Add(SERVERNAME)
sess.Login(USERID, PWD)
Dim db As IManDatabase = sess.Databases.ItemByName(DATABASENAME)
'Build a list databases in which to search
Dim dbList As New ManStrings
dbList.Add(db.Name) 'Example of searching under one database
'Build folder search criteria
Dim params As IManFolderSearchParameters = dms.CreateFolderSearchParameters
' Arbitrary example of search values by which to search
params.Add(imFolderAttributeID.imFolderName, "dss test") 'Arbitrary example of a folder name by which to search
params.Add(imFolderAttributeID.imFolderOwner, sess.UserID) 'Assuming the folder belongs to the currently logged-on user
'Search for the parent folder
Dim searchResults As IManFolders = sess.WorkArea.SearchFolders(dbList, params)
Dim parFldr As IManDocumentFolder
Dim chdFldrs As IManDocumentFolders
Dim newfldr As IManDocumentFolder
'Check search results
If False = searchResults.Empty Then
MsgBox("Parent folder not found.")
' Add subfolder
' Get parent folder
parFldr = searchResults.ItemByIndex(1) 'Assuming the target folder is the first item in the collection
chdFldrs = parFldr.SubFolders
newfldr = chdFldrs.AddNewDocumentFolder("new child", "test adding new subfolder.")
' this method adds a new subfolder that inherits the parent folder's security settings.
'newfldr = chdFldrs.AddNewDocumentFolderInheriting("new child", "test adding new subfolder.")
Exit Try
End If
'***** NOTE: SearchFolders is just one of the methods that can be used to find the target folder.
' There are also other methods such as GetObjectBySID or GetFolder.
======================================
Also, in the 8.x SDK, the COM Object for WorkSite Developer's Reference Manual.pdf has VB example on how to add a subfolder.
In the SDK, there is also the sample application to demonstrate how to use the CreateWorkspace Web Method. This is located in "
beynen
MANY MANY THANKS...
i think the last of your post has been cut... there is not the end of your post
many many thanks again, it will help me !!!
Neil
jny
The CreateWorkspace Web Method sample project is located in "\iToolKit\Sample Apps For 8.1\CreateWorkSpace"
beynen
great !!!
thanks again