Partager via


HostDistributionRuleCollection.AddRule Method (String, Guid)

Adds a new HostDistributionRule to the Search service application and caches it to the HostDistributionRuleCollection object.

Namespace:  Microsoft.Office.Server.Search.Administration
Assembly:  Microsoft.Office.Server.Search (in Microsoft.Office.Server.Search.dll)

Syntax

'Declaration
Public Sub AddRule ( _
    hostName As String, _
    crawlDatabaseGuid As Guid _
)
'Usage
Dim instance As HostDistributionRuleCollection
Dim hostName As String
Dim crawlDatabaseGuid As Guid

instance.AddRule(hostName, crawlDatabaseGuid)
public void AddRule(
    string hostName,
    Guid crawlDatabaseGuid
)

Parameters

Exceptions

Exception Condition
ArgumentNullException

hostname is null or an empty string.

ArgumentOutOfRangeException

hostname exceeds 250 characters, is in the incorrect format, or already exists in the Search service application.

-or-

The crawlDatabaseGuid is null or empty.

InvalidOperationException

The add operation failed.

Remarks

The hostname parameter can include a port number by appending :port to the name of the host computer, where port is the port number.

See Also

Reference

HostDistributionRuleCollection Class

HostDistributionRuleCollection Members

AddRule Overload

Microsoft.Office.Server.Search.Administration Namespace