Custom Error Message for Event Receiver in SharePoint 2010 -
i want users upload .doc files in document library.
to so, have developed event receiver in visual studio 2010.
my code follows:
public override void itemadding(spitemeventproperties properties) { try { base.itemadding(properties); eventfiringenabled = false; if (!properties.afterurl.endswith("doc")) { properties.errormessage = "you allowed updload .doc files"; properties.status = speventreceiverstatus.cancelwitherror; properties.cancel = true; } } catch (exception ex) { properties.status = speventreceiverstatus.cancelwitherror; properties.errormessage = ex.message.tostring(); properties.cancel = true; } }
the code referred this example.
my problem while uploading non-doc files preventing system error message not user friendly defined in properties.errormessage
.
how solve this?
please help.
i used same code have provided in question, custom error message displayed shown in below image -
please provide details of error getting.
Comments
Post a Comment