UnregisterForEvent Method

Applies to: SharePoint Foundation 2010

Unregisters an event for which a Web Part was previously registered.

UnregisterForEvent (NamespaceURN, EventName, Function, UniqueQualifier)

Parameters

Parameter

Description

NamespaceURN

A string naming a user-defined namespace that provides a context for resolving event names, object names, and so on.

EventName

The name of the event for which the Web Part is unregistering.

Function

The function that is called when the event occurs.

UniqueQualifier

Optional. A unique qualifier for the Web Part.

Remarks

This method unregisters an event that was previously registered using the RegisterForEvent Method.

When you use Microsoft Visual Basic Scripting Edition (VBScript) to unregister for events, the GetRef function cannot be included directly as an argument passed to the RegisterForEvent Method or UnregisterForEvent method for that event. Because each call to the GetRef function returns a different pointer value, the pointer that is returned when you register for an event is not the same as the pointer that is returned when you unregister for that event, and the UnregisterForEvent method fails.

To use the UnregisterForEvent method and RegisterForEvent Method method in VBScript for a particular event, you can assign the GetRef function to a variable and use that variable for the Function parameter in both methods. (For information about the GetRef function, see the VBScript documentation in the MSDN library).

Example 1: Microsoft Visual Basic Scripting Edition

Code

WPSC.UnRegisterForEvent "urn:testchange","onUpdate", GetRef("CheckWebPart")

Example 2: Microsoft JScript

Code

WPSC.UnRegisterForEvent("urn:testchange","onUpdate", CheckWebPart);

Requirements

Applies to: WPSC Object

See Also

Reference

RegisterForEvent Method

Other Resources

Web Part Page Services Component (WPSC) Object Model