Accessing IColumn Objects

You can access a specific IColumn object by calling the IColumns.Item property. Since IColumns is a collection, you can access all IColumn objects using a for each loop, as in the following example, where objColumn is the name you give to the IColumn object:

Option Explicit 
On Error Resume Next 

Dim objSearchAdmin, objBuildServer, objCatalogs, objCatalog, objSchema, objColumns, objColumn 

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

Wscript.Echo "The schema For " & objCatalog.Name & " has these columns:"

For Each objColumn in objColumns
  Wscript.Echo "  Name:         " & objColumn.Name 
  Wscript.Echo "  Description:  " & objColumn.Description 
  Wscript.Echo "  PropGuid:     " & objColumn.PropGuid 
  Wscript.Echo "  PropPid:      " & objColumn.PropPid 
  
  If objColumn.Retrieve Then
    Wscript.Echo "  Retrieved:    Yes"
  Else
    Wscript.Echo "  Retrieved:    No"
  End If 

  If objColumn.Index Then
    Wscript.Echo "  Indexed:      Yes"
  Else
    Wscript.Echo "  Indexed:      No"
  End If 

  Wscript.Echo "   Type:        " & objColumn.Type
  Wscript.Echo "   Length:      " & objColumn.Length
  Wscript.Echo ""

Next

'Release objects 
Set objColumn   = Nothing 
Set objColumns  = Nothing 
Set objSchema   = Nothing 
Set objCatalog  = Nothing 
Set objCatalogs = Nothing 
Set objBuildServer = Nothing 
Set objSearchAdmin = Nothing 
 

© 1997-1998 Microsoft Corporation. All rights reserved.