You create an IExtension interface object by calling the IExtensions.Add method. You can access a specific IExtension interface object by calling the Item property. Because IExtensions is a collection you can access all IExtension interface objects using a for each loop, as in the following example, where objExtension is the name you give to the IExtension interface object:
Option Explicit
On Error Resume Next
Dim objSearchAdmin, objBuildCatalog, objExtensions, objExtension
Set objSearchAdmin = CreateObject("Search.SearchAdmin.1")
'Add TMP extension to KMSampleCatalog1
Set objBuildCatalog = _
objSearchAdmin.BuildServer.BuildCatalogs("KMSampleCatalog1")
Set objExtension = objBuildCatalog.Extensions.Add("TMP")
For Each objBuildCatalog IN objSearchAdmin.BuildServer.BuildCatalogs
Set objExtensions = objBuildCatalog.Extensions
If objExtensions.Count > 0 Then
If objExtensions.IncludedExtensions Then
Wscript.Echo "Catalog " & objBuildCatalog.Name _
& " includes files with the following extensions:"
Else
Wscript.Echo "Catalog " & objBuildCatalog.Name _
& " excludes files with the following extensions:"
End If
For Each objExtension in objExtensions
Wscript.Echo " " & objExtension.Extension
Next
End If
Wscript.Echo ""
Next
'Release objects
Set objExtension = Nothing
Set objExtensions = Nothing
Set objBuildCatalog = Nothing
Set objSearchAdmin = Nothing