出于某种原因,当它停止工作时,我正在处理事件接收器。我正在更新它并从 Visual Studio 2010 进行部署,它以前可以工作,但是当我在查找字段时它停止了。即使我删除了刚刚添加的部分,它也不再起作用。有任何想法吗。谢谢你。
`/// An item was added.
/// </summary>
public override void ItemAdded(SPItemEventProperties properties)
{
base.ItemAdded(properties);
string fname = Convert.ToString(properties.AfterProperties["Title"]);
string Cdate = Convert.ToString(properties.AfterProperties["CDate"]).Substring(2, 2);
// ---- Lookup fields -----
String lookupZF = "Office";
String ZF = Convert.ToString(properties.ListItem[lookupZF]);
SPFieldLookupValue ZFValue = new SPFieldLookupValue(ZF);
// ------ End of lookup fields -----
string FName = fname + Cdate; // + ZFValue;
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(properties.Web.Site.ID))
{
using (SPWeb web = site.OpenWeb())
{
web.AllowUnsafeUpdates = true;
SPList CurrentList = web.Lists[properties.ListId];
SPListItem Litem = CurrentList.GetItemById(properties.ListItemId);
Litem["Description"] = "update working ...!";
Litem["Prop No."] = FName;
Litem.Update();
CurrentList.Update();
web.AllowUnsafeUpdates = false;
}
}
});
}`