Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

ItemUpdating event handling error

  Asked By: Dontae    Date: Aug 03    Category: Sharepoint    Views: 4757

I am getting following error when I implement ItemUpdating event handler for a
List.

Server Error in '/' Application.
--------------------------------------------------------------------------------

You cann't update the list item
Description: An unhandled exception occurred during the execution of the current
web request. Please review the stack trace for more information about the error
and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: You cann't
update the list item

Source Error:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can be
identified using the exception stack trace below.

Stack Trace:


[COMException (0x81020089): You cann't update the list item]
Microsoft.SharePoint.Library.SPRequestInternalClass.AddOrUpdateItem(String
bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean
bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid,
Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object&
pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties,
Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish) +0
Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String
bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion,
Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId,
Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object&
pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean
bCheckin, Boolean bMigration, Boolean bPublish) +199

[SPException: You cann't update the list item]
Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String
bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion,
Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId,
Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object&
pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean
bCheckin, Boolean bMigration, Boolean bPublish) +240
Microsoft.SharePoint.SPListItem.AddOrUpdateItem(Boolean bAdd, Boolean
bSystem, Boolean bPreserveItemVersion, Boolean bNoVersion, Boolean bMigration,
Boolean bPublish, Boolean bCheckOut, Boolean bCheckin, Guid newGuidOnAdd, Int32&
ulID, Object& objAttachmentNames, Object& objAttachmentContents, Boolean
suppressAfterEvents) +933
Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean
bPreserveItemVersion, Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish,
Boolean bNoVersion, Boolean bCheckOut, Boolean bCheckin, Boolean
suppressAfterEvents) +182
Microsoft.SharePoint.SPListItem.Update() +89
Microsoft.SharePoint.WebControls.SaveButton.SaveItem(SPContext itemContext,
Boolean uploadMode, String checkInComment) +458
Microsoft.SharePoint.WebControls.SaveButton.SaveItem() +58
Microsoft.SharePoint.WebControls.SaveButton.OnBubbleEvent(Object source,
EventArgs e) +249
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
+163

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBa\
ckEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl,
String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +174
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,
Boolean includeStagesAfterAsyncPoint) +5102


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET
Version:2.0.50727.832

Code used for event handling:
public override void ItemUpdating(SPItemEventProperties properties)
{
properties.Cancel = true;
properties.ErrorMessage = "You cann't update the list item";

}


please help, am I missing any steps in implementation.

Share: 

 

4 Answers Found

 
Answer #1    Answered By: Lee Dickerson     Answered On: Aug 03

You are getting exactly what your code  has asked for. When you set
properties.cancel=true and then set the errormessage property,
SharePoint will interrupt the updating of that item and send the user an
errormessage page  with the errormessage that you specify. The
errormessage is delivered via the customErrors page. You evidently have
CustomErrors set to "Off" for this web  Application, so you are getting
the actual error  instead. Either don't use the errormessage property or
turn CustomErrors back on in the Web.config.

 
Answer #2    Answered By: Aditiya Kapale     Answered On: Aug 03

I am also implementing ItemDeleting handler  along with ItemUpdating. When I try
to delete to list  item, I am getting following custom error  message(Just 2
lines) which I set in handler

" Go back to site
Error

You cannot delete the request!
Troubleshoot issues with Windows sharepoint  Services. "

Code for ItemDeleting:
public override void ItemDeleting(SPItemEventProperties properties)
{
properties.Cancel = true;
properties.ErrorMessage = "You cannot delete the request!";

}

 
Answer #3    Answered By: Cristopher Gould     Answered On: Aug 03

I just did a quick ItemUpdating eventhandler on an announcements list
with the code  that you provided. It works fine for me. What kind of
list are you doing this one. Is it a document library?

 
Answer #4    Answered By: Selena Glenn     Answered On: Aug 03

I am using HelpDesk template's "Service Requests" list.

 
Didn't find what you were looking for? Find more on ItemUpdating event handling error Or get search suggestion and latest updates.




Tagged: