Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
WCrihfield
in reply to: s.hofsteenge

Hi @s.hofsteenge.  Here is your code that I have modified a bit in a few places, and includes the extra code for moving those 3 folders over under the one folder, as you mentioned.  I also switched from using an ArrayList type collection to using a List(Of String) type collection, because it is more accurate for what we need here (a list of String values, not just a generic collection for any object type).   I also used a bit more code to make sure we are working with the true model browser pane, not one of the other ones.  

Dim oDoc As Document = ThisApplication.ActiveDocument
Dim oPanes As BrowserPanes = oDoc.BrowserPanes
Dim oModelPane As BrowserPane = Nothing
For Each oBP As BrowserPane In oPanes
	If oBP.BuiltIn And oBP.TreeBrowser And _
		(oBP.InternalName = "AmBrowserArrangement" Or _
		oBP.InternalName = "DlHierarchy" Or _
		oBP.InternalName = "PmDefault") Then
		oModelPane = oBP
	End If
Next
Dim oTopNode As BrowserNode = oModelPane.TopNode

Dim FolderNames As New List(Of String)
FolderNames.Add("10 Hulpframe")
FolderNames.Add("20 Laadbak")
FolderNames.Add("20.1 Snij-zetwerk") 'move them under this folder
FolderNames.Add("kb klant specifiek") 'move to sub folder
FolderNames.Add("spb-oph klant specifiek") 'move to sub folder
FolderNames.Add("db-strip klantspecifiek") 'move to sub folder
FolderNames.Add("20.2 Zaagwerk")
FolderNames.Add("20.3 Kluytmans standaard delen")
FolderNames.Add("db")
FolderNames.Add("ITL-GSM")
FolderNames.Add("spb-oph")
FolderNames.Add("Beugel wl + zijmarkeerlamp")
FolderNames.Add("20.4 inkoopdelen")
FolderNames.Add("werklampen")
FolderNames.Add("bindogen")
FolderNames.Add("21 Kopschot")

Dim oFolder As BrowserFolder
For Each sFolderName In FolderNames
    Try
	    oFolder = oTopNode.BrowserFolders.Item(sFolderName)
    Catch
        oFolder = oModelPane.AddBrowserFolder(sFolderName)
    End Try
Next

Dim oParentFolder As BrowserFolder = oTopNode.BrowserFolders.Item("20.1 Snij-zetwerk")
oParentFolder.AllowAddRemove = True
oParentFolder.AllowReorder = True
oParentFolder.AllowRename = True
'oParentFolder.AllowDelete = True
Dim oChildFolder1 As BrowserFolder = oTopNode.BrowserFolders.Item("kb klant specifiek")
Dim oChildFolder2 As BrowserFolder = oTopNode.BrowserFolders.Item("spb-oph klant specifiek")
Dim oChildFolder3 As BrowserFolder = oTopNode.BrowserFolders.Item("db-strip klantspecifiek")
oParentFolder.Add(oChildFolder1.BrowserNode)
oParentFolder.Add(oChildFolder2.BrowserNode)
oParentFolder.Add(oChildFolder3.BrowserNode)

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)