我认为这很简单,但不要猜测。我有下面的代码,它部署和激活得很好,但是当我向文档库中添加一个新文档时,没有任何反应。没有错误。这是直接来自另一个来自网上的人说的,它的工作原理。在SharePoint文档库中添加或创建文档时为自定义列分配值
下面的代码为我的特点:
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);
}
}
}
简单吧!为什么这不起作用?除了我指定的自定义列的名称之外,是否需要以某种方式指定文档库的名称?我迷失在这个人身上,渴望得到解决方案。这是一个SharePoint 2007环境,发布站点。
感谢您的帮助!
是否需要重启表明,即使您的文件已被部署到GAC,一个进程锁定它。下一次尝试运行IISRESET并查看它是否可行。 – 2009-07-20 10:09:17