I have been anticipating this hotfix for a while now. In late September 2011, I opened a support incident with Microsoft Support (specifically the Microsoft SharePoint Developer Support team) regarding custom error message support using a SharePoint 2010 Datasheet view. I was told that the Datasheet View did not support custom error messages and that this was a known by design limitation. For a few months, I worked with Microsoft Support and got them to lobby the SharePoint and Access Product Teams to see if we could get this changed. The Access Team stepped in (as they are responsible for the ActiveX control that powers the Datasheet View) and agreed to issue a hotfix! Here it is:
Access 2010 hotfix package (Acewss-x-none.msp, Stslist-x-none.msp): February 28, 2012: http://support.microsoft.com/kb/2597943
Kudos to the Access Team for fixing this – it is much appreciated by the SharePoint community!
Before I get into the hotfix details, here are links to the Forums and Wiki addressing this topic. Conversations have been going on about this for a while…
- Forums Post: List Datasheet view ItemUpdating – Cancel event end user error message support
- Wiki Article: Updated: SharePoint Datasheet View Now Supports Event Receiver Custom Error Messages (hotfix issued) (en-US)
The concept is trivial – in an event receiver, I want to cancel the event with errors and display a custom error message to the end user who is using a SharePoint 2010 Datasheet view.
Here is an example:
public override void ItemAdding(SPItemEventProperties properties)
string title = properties.AfterProperties["Title"].ToString();
// Error condition
if (title == "Testing")
// Cancel with error
properties.Status = SPEventReceiverStatus.CancelWithError;
// Custom error message
string ErrorMessage = "Testing is not a valid entry. Please try again";
// Set properties error message
properties.ErrorMessage = ErrorMessage;
Before installing this hotfix, if you run the above code, no matter your scenario, the only error message you’ll ever see in a Datasheet View is “An unexpected error has occurred. Changes to your data cannot be saved”. This wasn’t helpful and surely prevented developers from using this view type.
Here are the before and after screenshots when running the above event receiver code. Note that when the error occurs, the exclamation point icon appears beside the list item in question. To see the error message, click on the exclamation point icon.
Notes based on my testing:
- The hotfix details say that you need to have Access 2010 installed. I have found this not to be true, however you do need Office 2010 installed. I installed this hotfix on a Windows 7 machine without Access 2010 and it works fine
- The hotfix details say that you don’t need to reboot the machine after installation. After installing this hotfix on many machines, I was prompted once to reboot the computer after installation
Additional important notes:
- This only applies to Office 2010 – there won’t be a hotfix for Office 2007.
- I have not tested this in an environment with Office 2010 and SharePoint 2007. I was told this scenario is not supported. If someone out there tests this scenario, please “Contact Me” and let me know so I can share your results with the community.
Last but certainly not least, this hotfix would not have been possible without the Microsoft SharePoint Developer Support team. It was a pleasure working with you guys on this. Your efforts were simply outstanding.