Populating the Catalog Tree View
Note
Indexing Service is no longer supported as of Windows XP and is unavailable for use as of Windows 8. Instead, use Windows Search for client side search and Microsoft Search Server Express for server side search.
This code segment uses the FindFirstCatalog and FindNextCatalog methods of the gCiAdmin AdminIndexServer object to enumerate all Indexing Service catalogs. For each found catalog, it uses the GetCatalog method of the gCiAdmin AdminIndexServer object to create CiCatalog, a CatAdm object. It then uses the CatalogName and CatalogLocation properties of the CiCatalog CatAdm object to add the name and location of each found catalog to the tree view and list view on the form. The PopulateCatalogTreeView procedure is called when the application starts and whenever the Connect button is clicked.
Private Sub PopulateCatalogTreeView()
...
Dim fFound As Boolean
' Loop through Indexing Service catalogs populating the tree control.
fFound = gCiAdmin.FindFirstCatalog
Dim CiCatalog As Object
Dim lItem As ListItem
mTVNodeCount = 1
While (fFound)
mTVNodeCount = mTVNodeCount + 1
Set CiCatalog = gCiAdmin.GetCatalog()
Set nodX = TreeView1.Nodes.Add(mtcIndex, tvwChild, , CiCatalog.CatalogName)
nodX.Tag = CiCatalog.CatalogLocation
Set lItem = ListView1.ListItems.Add(, , CiCatalog.CatalogLocation)
Set CiCatalog = Nothing
fFound = gCiAdmin.FindNextCatalog
Wend
...
End Sub