BanUsers MethodBanUsers Method*
*Contents  *Index  *Topic Contents
*Previous Topic: AboutBox Method
*Next Topic: CancelConnectLogin Method

BanUsers Method

Bans users from the server and reinstates users to the server.

Syntax

object.BanUsers UserItems, Set[, Reason][, Duration]

Parameters

objectRequired. An object expression that evaluates to an MsChatPr control.
UserItemsRequired. An object expression that evaluates to a ChatItems object. Defines which users are banned or reinstated. The item names that can be used to construct the ChatItems object are:
Nickname
NicknameOp
UserName
UserNameOp
IPAddress
IPAddressOp
SetRequired. A Boolean variable that determines whether the users are banned or reinstated.
ReasonOptional. A variant that is used if Set is TRUE to contain the reason for banishing users.
DurationOptional. A variant that is used if Set is TRUE to indicate, in minutes, the length of time a user or users will be banned.

Remarks

This feature is reserved for administrators and system operators only. Banned users will not be able to log on to the server. Some IRC servers do not provide this feature and will return an error code.

Examples

These examples illustrate methods of using BanUsers to ban users from the server and to reinstate users to the server.

1. Ban a specific user:

Dim chatitemobj As ChatItems
Set chatitemobj = New ChatItems
chatitemobj.AssociatedType  = "Query"
chatitemobj.Item("UserName") = "RebeccaH"
chatitemobj.Item("IPAddressOp") = "EndsWith"
chatitemobj.Item("IPAddress") = ".microsoft.com"
MsChatPr1.BanUsers chatitemobj, True, "Abusive behavior"
Set chatitemobj = Nothing

2. Ban all the users with an IP address that ends with .edu, for the duration of one hour:

Dim chatitemobj As ChatItems
Set chatitemobj = New ChatItems
chatitemobj.AssociatedType  = "Query"
chatitemobj.Item("IPAddressOp") = "EndsWith"
chatitemobj.Item("IPAddress") = ".edu"
MsChatPr1.BanUsers chatitemobj, True, , 60
Set chatitemobj = Nothing

3. Stop banning the same group:

Dim chatitemobj As ChatItems
Set chatitemobj = New ChatItems
chatitemobj.AssociatedType  = "Query"
chatitemobj.Item("IPAddressOp") = "EndsWith"
chatitemobj.Item("IPAddress") = ".edu"
MsChatPr1.BanUsers chatitemobj, False
Set chatitemobj = Nothing

Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.