I'm having trouble binding my event receiver (ItemAdding) event to a specific list. I created a Feature Receiver and tried both the GUID and Name. But, I have another list that uses the same column name that I am trapping for as the list I want to bind to, so it seems the event trips in this other list as well. I thought the Feature Receiver would prevent this. Here is how Im attempting this:
Public Overrides Sub FeatureActivated(ByVal properties As SPFeatureReceiverProperties)
Try
'Get a Reference to the Current Web
Dim oWeb As SPWeb = properties.Feature.Parent
'Get a Reference to the PEEIT%20StateLicenses List (Using the Lists Guid)
Dim oGUID As New Guid("{26712059-15E5-48A6-A26D-8A9A521418CF}")
'Dim oList As SPList = oWeb.Lists(oGUID)
Dim oList As SPList = oWeb.Lists("PEEIT State Licenses")
Dim sAssembyName As String = "WEC.SPS.Feature.SR558,Version=1.0.0.0,culture=neutral, PublicKeyToken=9c6f26b52f1522b5"
Dim sReceiverName As String = "WEC.SPS.Feature.SR558.EnforcePEEITListIntegrity"
'Attach Event Receiver to Specific List (PEEIT%20StateLicenses List)
oList.EventReceivers.Add(SPEventReceiverType.ItemAdding, sAssembyName, sReceiverName)
Catch ex As System.Exception
'Throw a message in the ULS Logging
Microsoft.Office.Server.Diagnostics.PortalLog.LogString("Exception Occurred on SR558-FeatureActivated: {0} || {1}", ex.Message, ex.StackTrace)
End Try
Bismarck