Previous in Contents Next in Contents

Creating and Accessing IServer Interface Objects

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

Option Explicit 
On Error Resume Next 

Dim objSearchAdmin, objServers, objServer, Site, nHitInterval 

Set objSearchAdmin = CreateObject("Search.SearchAdmin.1") 
Set objServers = objSearchAdmin.BuildServer.Sites 

'Add Microsoft.com to KMSampleCatalog1 
Site = "Microsoft.com"
objServers.Add(Site) 

'Get hit intervals
For Each objServer in objServers
  Set nHitInterval = objServer.HitInterval

  If nHitInterval = -1 Then
    Wscript.Echo "Search requests all docs simultaneously from " _
      & objServer.Name 
  ElseIf nHitInterval < -1 Then
    Wscript.Echo "Search requests " & -nHitInterval _
      & " doc(s) simultaneously from " & objServer.Name
  ElseIf nHitInterval > 0 Then
    Wscript.Echo "Search waits " & nHitInterval _
      & " second(s) after requesting docs from " _
      & objServer.Name "
  End If
Next

'Release objects 
Set objServer        = Nothing 
Set objSearchCatalog = Nothing 
Set objSearchAdmin   = Nothing 
 

© 1997-2000 Microsoft Corporation. All rights reserved.