I thought this would be pretty simple, but guess not. I have the following code, it deploys and activates just fine, but when I add a new document to the document library, nothing happens. No errors either. And this is taken directly from another example from someone online who said it works.
Here's the code for my feature:
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
namespace DocNumGenerator
{
class DocNumGenerator : SPItemEventReceiver
{
public override void ItemAdded(SPItemEventProperties properties)
{
base.ItemAdded(properties);
}
public override void ItemAdding(SPItemEventProperties properties)
{
properties.AfterProperties["DocNum"] = "4321";
base.ItemAdding(properties);
}
public override void ItemUpdated(SPItemEventProperties properties)
{
base.ItemUpdated(properties);
}
public override void ItemUpdating(SPItemEventProperties properties)
{
base.ItemUpdating(properties);
}
}
}
Simple right! Why doesn't this work? Do I need to somehow specify the name of the document library in addition to the name of the custom column that I am specifying? I'm lost on this one and desperate for a solution. This is a SharePoint 2007 environment, publishing site.
Thanks for any help!