Accessing IServer Objects

You access an IServer object by calling the IServers.Item property. Since IServers is a collection, you can access all IServer objects using a for each loop, as in the following example, where objServer is the name you give to the IServer object:

Option Explicit 
On Error Resume Next 

Dim objSearchAdmin, objBuildServer, objCatalogs, objCatalog, objServers, objServer 

Set objSearchAdmin = CreateObject("Search.SearchAdmin.1") 
Set objBuildServer = objSearchAdmin.BuildServer 
Set objCatalogs = objBuildServer.BuildCatalogs 
Set objCatalog  = objCatalogs("KMSampleCatalog1") 
Set objServers  = objCatalog.Sites 

For Each objServer in objServers 
  ...
Next

'Release objects 
Set objServer   = Nothing 
Set objServers  = Nothing 
Set objCatalog  = Nothing 
Set objCatalogs = Nothing 
Set objBuildServer = Nothing 
Set objSearchAdmin = Nothing 
 

© 1997-1998 Microsoft Corporation. All rights reserved.