UnRegisterForEvent Method

This method specifies an event for which an event sink no longer listens.

Syntax

ReplicationEventSinkConfig.UnRegisterForEvent[=Event]

Parameters

Event

The event with which the event sink is no longer interested.

Remarks

You must have Site Server Publishing administrator privileges on the server to call this method.

If the ProjectFilter property is True, unregistering from an event from any of a project's event sinks also unregisters the event from all of the other project event sinks. If the ProjectFilter property is False, the unregistering only affects the current event sink.

Example

The following example instructs the NT event sink to no longer receive file sent events.

Option Explicit 
On Error Resume Next

const CRS_ERROR_NO_MORE_ITEMS  = 0&80003B17
const CRS_EVENT_SENT_FILE    = 0&4000377A

dim ReplServer
set ReplServer = CreateObject("CrsApi.ReplicationServer")
ReplServer.Initialize("")

dim Iterator
Iterator = 0
dim EvSink

do while True
  'Clear any error text
  Err.Clear
  'Get an event sink
  set EvSink = ReplServer.EnumEventSinks(Iterator)

  'Quit if empty object returned (no more instances)
  if IsEmpty(EvSink) then exit do

  'Quit if "No more items" error 
  dim ReplError
  ReplError = Err.Number
  if ReplError = CRS_ERROR_NO_MORE_ITEMS then exit do

  if EvSink.CLSID = "NT" then 
    EvSink.UnRegisterForEvent(CRS_EVENT_SENT_FILE)
    exit do
  end if
Loop

'Release objects
set EvSink     = Nothing
set ReplServer = Nothing

See Also

ProjectFilter, RegisterForEvent, ReplicationServer.AddEventSink, ReplicationServer.EnumEventSinks


© 1997-1998 Microsoft Corporation. All rights reserved.