Home
TeamSite
Adding Documents to Folder
GlenW
In the project I am working on, I iterate through the folders of an existing workspace. For each folder, I am trying to create document shortcuts for any documents that match the folder's default profile information (Client#, Matter#, Class, Subclass).
The code SEEMS to be working. From tracing my code, I KNOW that I have the correct workspace object and folder object; I am getting the correct collection of documents; and the code to add the shortcut runs without generating any vb.net exceptions or profile errors. The code I'm using to create the shortcut is out of Interwoven's SDK training book.
Everything seems to run fine, but no shortcut is ever created!!! HELP! Code snippets are included below.
Sincerely,
Glen Wolinsky
profileParms = dms.CreateProfileSearchParameters
With profileParms
.Add(imng.imProfileAttributeID.imProfileCustom1, profCliNum)
.Add(imng.imProfileAttributeID.imProfileCustom2, profMtrNum)
.Add(imng.imProfileAttributeID.imProfileClass, profClass)
.Add(imng.imProfileAttributeID.imProfileSubClass, profSubClass)
End With
results = db.SearchDocuments(profileParms, True)
If results.Count > 0 Then
Dim doc As imng.IManDocument
For Each doc In results
If doc.ObjectType.ObjectType = imng.imObjectType.imTypeDocument Then
DirectCast(FolderToFill.Contents, imng.IManContentShortcuts).AddNewContentShortcut(doc)
End If
Next
End If
Find more posts tagged with
Comments
jny
I was able to add a content shortcut to a document folder successfully using either of these methods:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim odms As New IManage.ManDMS
Dim osess As IManage.IManSession = odms.Sessions.Add("server_name")
osess.TrustedLogin()
Dim ofps As IManage.IManFolderSearchParameters = odms.CreateFolderSearchParameters()
ofps.Add(IManage.imFolderAttributeID.imFolderName, "testfolder")
Dim odbs As New IManage.ManStrings
odbs.Add(osess.PreferredDatabase.Name)
Dim ofldrs As IManage.IManFolders = osess.WorkArea.SearchFolders(odbs, ofps)
Dim ofldr As IManage.IManDocumentFolder = ofldrs.ItemByIndex(1)
Dim oparms As IManage.IManProfileSearchParameters = odms.CreateProfileSearchParameters()
oparms.Add(IManage.imProfileAttributeID.imProfileCheckedOut, "N")
oparms.Add(IManage.imProfileAttributeID.imProfileAuthor, osess.UserID)
Dim odox As IManage.IManDocuments = osess.PreferredDatabase.SearchDocuments(oparms, True)
' Method-1
For Each odoc In odox
If odoc.ObjectType.ObjectType = IManage.imObjectType.imTypeDocument Then
DirectCast(ofldr.Contents, IManage.IManContentShortcuts).AddNewContentShortcut(odoc)
End If
Next
' Method-2
'Dim i As Integer
'For i = 1 To odox.Count
' If odox.ItemByIndex(i).ObjectType.ObjectType = IManage.imObjectType.imTypeDocument Then
' DirectCast(ofldr.Contents, IManage.IManContentShortcuts).AddNewContentShortcut(odox.ItemByIndex(i))
' End If
'Next
Me.Close()
End Sub
GlenW
Thanks for your time and effort, but that is more or less the same code I'm using.
One thing I noticed while tracing the code: In my For...Next loop, as I'm adding the doc shortcuts, I'm tracing the folder.contents.count value and it DOES increment with each added shortcut. It totally seems to be working. But when I go to Worksite and pull up the matter workspace and navigate to the tab/folder, nothing is there. I can add shortcuts manually via the Worksite interface and that item shows up in the folder.contents.count when I re-run the code.
This is really wierd. Am I running an old copy of the dll or something? (v 8.0.0.0)
Thanks,
Glen
jny
Are you not seeing your new shortcuts after refreshing the root node, "My Folders"?
GlenW
Final answer: I've run across a bug in the Worksite Web interface. They will be working on a fix.
Symptoms: When programatically creating doc shortcuts in folders, any shortcuts in folders that are located in workspace tabs don't show up in Worksite Web. They show up just fine in Desksite, though.
jny
This bug has been reported and will be fixed for inclusion in a form of a hotfix or service pack -- post WorkSite 8.0 Web HF1.