Accessing IMapping Objects

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

Option Explicit 
On Error Resume Next 

Dim objSearchAdmin, objBuildServer, objCatalogs, objCatalog, objMappings, objMapping 

Set objSearchAdmin = CreateObject("Search.SearchAdmin.1") 
Set objBuildServer = objSearchAdmin.BuildServer 
Set objCatalogs = objBuildServer.BuildCatalogs 

For Each objCatalog in objCatalogs 
  Set objMappings = objCatalog.objMappings 
  Wscript.Echo "objCatalog " & objCatalog.Name & " maps the following:"

  For Each objMapping in objMappings
    Wscript.Echo "  " & objMapping.From & " to " & objMapping.To
  Next
Next

'Release objects 
Set objMapping  = Nothing 
Set objMappings = Nothing 
Set objCatalog  = Nothing 
Set objCatalogs = Nothing 
Set objBuildServer = Nothing 
Set objSearchAdmin = Nothing 
 

© 1997-1998 Microsoft Corporation. All rights reserved.