Original Title:
<nativehr>
0x81020089</nativehr>
in ItemUpdating (i.e. Synchronous) Event Receiver
Edited Question:
In the past when you created an item-based, synchronous event receiver that canceled the event and showed the user a message, you received custom SharePoint error page displaying your message. This is no longer the case and to achieve this behavior, which was the default in the past, you need to modify the Web.config as described below. Other than modifying the Web.config is there any method to display the custom error message to users as was done in the past?
Original Question and Additional Details:
I am receiving the above error in a "yellow screen of death" ASP.NET error page in an ItemUpdating event receiver where I have done the typical:
properties.Status = SPEventReceiverStatus.CancelWithError;
//It does not matter if I use Cancel or CancelWithError
properties.ErrorMessage = "You must be a member of the " + MarketNeedGroups.EngineeringManagers + " group to modify the " + field + " field";
properties.Cancel = true;
Some people seemed to think that it was due to the CustomErrors being set to "off" but that was clearly not the issue I was having as that was set to RemoteOnly on my dev box.
Another person suggested changing
<SafeMode MaxControls="200" CallStack="true" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">
to CallStack="false"
which I did and it corrected the issue. The amount of crazy answers I saw from people who clearly had no idea what was going on, however, lead me to question this as the best choice. Are there any other possibilities to correct this?
Edit:
I went back and checked some old code that has been in production for the better part of a year now. In said code I perform the same cancel but in an ItemDeleting
Event Receiver. If you see this article on MSDN you will notice that it should present the user with a much less scary custom SharePoint error message. In the past my ItemDeleting
event receiver displayed the same style of custom error message. It no longer does this. It now presents the user with a the YSOD. I verified the settings of the Web.config from a backup dated from over a year ago and CallStack="true"
was exactly the same.
I don't want to modify this setting if I don't have to, but since the chances of me figuring out what has changed are zero, I will just keep this setting in the Web.config set to false. I certainly do not want my users to see the YSOD page as this will generate helpdesk tickets because users will not actually read the message, they will just assume that there was some sort of error in code. There is even discussion of this issue in the MSDN article above in the comments section.
In the Asynch events the error page still seems to be displayed properly. Meaning this exact code does not generate a YSOD but displays the custom SharePoint error.