You create an IMapping interface object by calling the IMappings.Add method. You access an IMapping interface object by calling the Item property. Because IMappings is a collection, you can access all IMapping interface objects using a for each loop, as in the following example, where objMapping is the name you give to the IMapping interface object:
Option Explicit
On Error Resume Next
Dim objSearchAdmin, objBuildCatalog, objMapping
Set objSearchAdmin = CreateObject("Search.SearchAdmin.1")
'Add C:\InetPub\wwwroot to KMSampleCatalog2
Set objBuildCatalog = _
objSearchAdmin.BuildServer.BuildCatalogs("KMSampleCatalog2")
objBuildCatalog.Mappings.Add "C:\InetPub\wwwroot", _
"http://www.microsoft.com"
For Each objBuildCatalog in objSearchAdmin.BuildServer.BuildCatalogs
If objBuildCatalog.Mappings.Count > 0 Then
Wscript.Echo "Catalog " & objBuildCatalog.Name _
& " maps the following:"
For Each objMapping in objBuildCatalog.Mappings
Wscript.Echo " " & objMapping.From & " to " & objMapping.To
Next
Wscript.Echo ""
End If
Next
'Release objects
Set objMapping = Nothing
Set objBuildCatalog = Nothing
Set objSearchAdmin = Nothing