Code for deleting folders in the browser tree

Code for deleting folders in the browser tree

Anonymous
Not applicable
550 Views
1 Reply
Message 1 of 2

Code for deleting folders in the browser tree

Anonymous
Not applicable

Hi,

 

I got the code here from an old thread. It creates folders in the browser tree. Is it possible to make a code that does the opposite of what this code does?

 

So that it deletes "Folder 1" and "Folder 2"

 

 

Dim oFN() As String = {
"Folder 1",
"Folder 2" }
Dim oDoc As Document = ThisApplication.ActiveDocument
Dim oPane As BrowserPane = oDoc.BrowserPanes.ActivePane
For Each oFolderName As String In oFN
	Dim oFolder As BrowserFolder = Nothing
	Try
		oFolder = oPane.TopNode.BrowserFolders(oFolderName)
	Catch
		oFolder = oPane.AddBrowserFolder(oFolderName, Nothing)
	End Try
Next
0 Likes
Accepted solutions (1)
551 Views
1 Reply
Reply (1)
Message 2 of 2

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@Anonymous,

 

Try below iLogic code.

 

Dim oFN() As String = {
"Folder 1",
"Folder 2" }
Dim oDoc As Document = ThisApplication.ActiveDocument
Dim oPane As BrowserPane = oDoc.BrowserPanes.ActivePane
For Each oFolderName As String In oFN
	Dim oFolder As BrowserFolder = Nothing
	Try
		oFolder = oPane.TopNode.BrowserFolders(oFolderName)
		Call oFolder.Delete
	Catch
		 MessageBox.Show(oFolderName & " - does not exists", "iLogic")
	End Try
Next

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network