Previous in Contents Next in Contents

Accessing an IGatherLog Interface Object

You access a specific IGatherLog interface object by calling the Item property. Because IGatherLogs is a collection, you can access all IGatherLog interface objects using a for each loop, as in the following example, where objLog is the name you give to the IGatherLog interface object:

Option Explicit 
On Error Resume Next 

Dim objSearchAdmin, objBuildCatalog, objLogs, objLog 

Set objSearchAdmin   = CreateObject("Search.SearchAdmin.1") 

For Each objBuildCatalog in objSearchAdmin.BuildServer.BuildCatalogs
  Set objLogs = objBuildCatalog.Logs

  If objLogs.Count > 0 Then
    Wscript.Echo objBuildCatalog.Name & " has " _
      & objLogs.Count & " log(s):"

    For Each objLog in objLogs
      Wscript.Echo "  Log file " & objLog.Name & " is in the " _
        & objLog.Path & " directory, was created at "_
        & objLog.Created & " and is " & objLog.Size & " bytes in size"
      Wscript.Echo ""
    Next
  Else
    Wscript.Echo objBuildCatalog.Name & " has no logs."
  End If

  Wscript.Echo ""
Next

'Release objects 
Set objLog           = Nothing 
Set objLogs          = Nothing 
Set objBuildCatalog  = Nothing 
Set objSearchAdmin   = Nothing 
 

© 1997-2000 Microsoft Corporation. All rights reserved.