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)
Are there methods to create subfolders using IManFolder(s)?
MarcelVanKempen
Here is our sample code. The two issues are noted in bold.
Private Sub cmdCreateNewFolders_Click()
Dim oDMS As IManDMS
Dim oSession As IManSession
Dim oWorkArea As IManWorkArea
Dim oFolders As IManFolders
Dim oFolderSearchParams As IManFolderSearchParameters
Dim oManStrings As ManStrings
Dim ItemByIndex As Integer
Dim oNrtFolder As NRTFolder
'
' Get a DMS to create a session.
'
Set oDMS = New ManDMS
Set oSession = oDMS.Sessions.Add("D4MT")
'
' Connect
'
oSession.TrustedLogin
'
' We needed a session to create a Work area
'
Set oWorkArea = oSession.WorkArea
Set oManStrings = New ManStrings
oManStrings.Add oSession.Databases.ItemByIndex(1).Name
Set oFolderSearchParams = oDMS.CreateFolderSearchParameters
oFolderSearchParams.Add imFolderName, "Herbert Horatio Bartle Bobton-Trent"
'
' We needed a Work area to be able to search for a folder.
'
Set oFolders = oWorkArea.SearchFolders(oManStrings, oFolderSearchParams)
If oFolders.Count = 0 Then Exit Sub
'
' IManFolder(s) don't have methods to create subfolders but NRTFolders do.
' But NRTFolders don’t have methods to find folders.
‘
OIALib.GetCurrentSessionDetails
'
' We needed an NRTDMS to create an NrtFolder from the IManFolder's id.
'
Set oNrtFolder = OIALib.pNRTDMS.GetObjectByID(oFolders.ItemByIndex(1).ObjectID)
oNrtFolder.CreateSubFolder “First new sub folder”, “First new sub folder”, nrPublic
oNrtFolder.CreateSubFolder “Second new sub folder”, “Second new sub folder”, nrPublic
‘
‘ Neither the IManFolder nor the NRTFolder Refresh method refreshes the FileSite folders.
‘ The created folders do not appear until the user clicks on the FileSite Refresh button.
‘
oNrtFolder.Refresh
oFolders.ItemByIndex(1).Refresh
End Sub
Find more posts tagged with
Comments
guido1
Avoid using NRTxxx object model where possible (although it's unavoidable for some of the Extensibility commands). Check out my reply in a previous posting of yours: i think it's the same problem