I cant seem to figure out what the issue is while I try to deploy my event receiver targeted at a particular list on my site.
All I am trying to do in the event receiver is to check (on itemUpdating) if property of a department field in a list item changes pop an alert.
I have checked out the following links but none of the solutions seem to fit my situation.
Here is the code I have:
namespace EmployeeTransferVS1.EmployeeTransferUpdating
{
/// <summary>
/// List Item Events
/// </summary>
public class EmployeeTransferUpdating : SPItemEventReceiver
{
/// <summary>
/// An item is being updated.
/// </summary>
///string siteUrl = "";
public override void ItemUpdating(SPItemEventProperties properties)
{
base.ItemUpdating(properties);
try
{
if (properties.BeforeProperties["Department"] != properties.AfterProperties["Department"])
{
Console.Write(@"<script language='javascript'>alert('Updated');</script>");
}
}
catch (Exception ex)
{
throw ex;
}
}
And here is the elements.xml file with my targeted ListURL
Please note that I have tested the url and the list access via my CAML builder and I am able to access and query just fine with the same account.
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Receivers ListUrl="EPD">
<Receiver>
<Name>EmployeeTransferUpdatingItemUpdating</Name>
<Type>ItemUpdating</Type>
<Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
<Class>EmployeeTransferVS1.EmployeeTransferUpdating.EmployeeTransferUpdating</Class>
<SequenceNumber>10000</SequenceNumber>
</Receiver>
</Receivers>
</Elements>
Any ideas/suggestions?
Thanks!