I have a custom list and I have written an itemUpdating event on it. The event sends an email to some users with updated data. When I click on save, the changes are not saved, though i get the email with updated data. This is the error message
Save Conflict Your changes conflict with those made concurrently by another user. If you want your changes to be applied, click Back in your Web browser, refresh the page, and resubmit your changes.
and this is the tracelogs
SPException: Save Conflict Your changes conflict with those made concurrently by another user. If you want your changes to be applied, click Back in your Web browser, refresh the page, and resubmit your changes.] Microsoft.SharePoint.WebControls.SaveButton.SaveItem(SPContext itemContext, Boolean uploadMode, String checkInComment) +20559885 Microsoft.SharePoint.WebControls.SaveButton.OnBubbleEvent(Object source, EventArgs e) +1372 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +70 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981
Here is the code for itemUpdating event
public override void ItemUpdating(SPItemEventProperties properties)
{
try
{
this.DisableEventFiring();
base.ItemUpdating(properties);
//logic to check the updated properties and send email
}
catch (Exception ex)
{
SPDiagnosticsService.Local.WriteTrace(0, category, TraceSeverity.Unexpected, "There was an error occured.\n" + ex.Message);
log.AppendLine("There was an error occured.\n" + ex.Message);
}
finally
{
this.EnableEventFiring();
SPDiagnosticsService.Local.WriteTrace(0, category, TraceSeverity.Verbose, " execution complete for user : " + properties.UserDisplayName);
}
}
my feature event receiver
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
// Get data from a list.
SPListItemCollection items = listMessages.GetItems(query);
foreach (SPListItem listItem in items)
{
var listNameToAttachEvent = listItem["List"].ToString();
SPList listToAttachEvent = currentWeb.Lists.TryGetList(listNameToAttachEvent.Trim());
if (null == listToAttachEvent) continue;
DeleteEventReceivers(listToAttachEvent, ClassNameForAlert);
listToAttachEvent.EventReceivers.Add(SPEventReceiverType.ItemAdded, Assembly, ClassNameForAlert);
listToAttachEvent.EventReceivers.Add(SPEventReceiverType.ItemUpdating, Assembly, ClassNameForAlert);
listToAttachEvent.Update();
}
}
catch (Exception ex)
{
SPDiagnosticsService.Local.WriteTrace(0, category, TraceSeverity.Unexpected,ex.Message);
SPDiagnosticsService.Local.WriteTrace(0, category, TraceSeverity.Unexpected, ex.StackTrace);
}
finally
{
if (currentWeb != null)
{
currentWeb.Dispose();
}
}
}