.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

SharePoint Event REceivers and Custom Error Messages.

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :C#
I have an ItemAdding Event Receiver, with the following code fragment

properties.ErrorMessage = string.Format("{0} is already registered for this program.",item["Attendee Name"].ToString()));

properties.Cancel = true;

properties.Status = SPEventReceiverStatus.CancelWithError;


despite of the custom error message being set, I receicve the following error.

View Complete Post

More Related Resource Links

Quick Note: Add Event Receivers to SharePoint 2010 Lists

In this exercise, you add an event receiver to a custom Microsoft SharePoint 2010 list that is triggered when you attempt to delete an item in the list.

Returning custom error messages with an UserNamePasswordValidator

Ok, my head hurts from banging it against the wall. I'm new to WCF, I have searched for a solution for days, please help a desperate fellow programmer if you can :-( I have a WCF service hosted in IIS, I implemented a UserNamePasswordValidator, and it seems impossible to find a way to return a custom error message to the client when the user is not allowed in, this blows my mind. I have searched everywhere, many are asking the same question since 2006 and so far I haven't found an answer that works. If you are thinking of replying that it is not secure to return a custom error message to an unauthenticated client, please save yourself some time and don't do it. There are multiple enterprise business scenarios that this is required. Just in our organization an account could be locked out, in which case the user must be directed to the IT department to get it unlocked, it could be that the credentials are correct but the user hasn't paid their fees in which case they must be directed to the appropriate department, or it could even be that the user tried to access the service during a time of the day in which the service is not available. From searching around, I have tried doing the things below in the Validate method, however the client always receives a MessageSecurityException, which contains none of the custom messages that were originally thrown, neither in the object,

custom 401/login failure error messages

I have a req to display a custom error message when a user fails to log in 3 times.  The default behavior seem to be for a redirect to something like this http://server/_layouts/AccessDenied.aspx?loginasanotheruser=true&Source=http%3A%2F%2Fserver2k7%2FPages%2FDefault%2Easpx after the third login attempt.  The resulting page just comes up as blank...I'm guessing because it failed auth.  My initial thoughts were to create a custom error page, and redirect with an http module.  That solution (while it does redirect) puts me right back to the initial problem of just a blank page being displayed after the failed auth.  I've been struggling with this for a while now, ANY thoughts or advice would be greaty appreciated.  Is it even possible? 

List Event Receivers firing for all custom lists

Hello, I have a site with two custom lists, and I have created an EventReceiver class to handle the ItemAdded event for custom lists. I have modified the EventReceiver's Elements.xml file to only handle items added to one of the custom lists instead of all custom lists, by changing: <Receivers ListTemplateId="100"> to <Receivers ListUrl="/Lists/MyCustomList">   however, when debugging, the ItemAdded method is being fired when an item is added in both custom lists. I have had to work around this by checking within the ItemAdded method for the list that fired the event:        public override void ItemAdded(SPItemEventProperties properties)        {            base.ItemAdded(properties);            if (properties.ListTitle.Equals("My Custom List")) { ... } I thought the ListUrl attribute of the Receivers element specifies the event to only fire for the specific list with that url? (see http://msdn.microsoft.com/en-us/library/ms431081.aspx). Is there somewhere else I should be checking?   Thanks

Unable to Customize Custom Lists. Sharepoint Error: User cannot be found.

I am not sure what the best way to put/describe my issue . I am unable to customize my custom list. Steps: 1. Login to sharepoint site. 2. Site Actions -> Site Settings 3. Under Site Administration -> Site Libraries and lists 4. Clicked on a custom list.   Error: Error User cannot be found.   Troubleshoot issues with Microsoft SharePoint Foundation. Correlation ID: 4063bf58-9cb7-4204-8cc4-cc2889abffe3 Date and Time: 9/9/2010 5:51:58 PM   I figured this may be an issue with site permissions, so I have went into site permissions and removed and re-added Administrator into Homeowners group.   Thank you in advance.   Howie

Need to Remove Event Log Error after deleting a database sharepoint 2010


I deleted a couple of databases  fron SQL after recreating  the service application. I am getting event log errors  ID 3760 that these db's are unable to be located.

How do I remove the trigger that is making this error apear?

I have looked all through CA but unable to figuer it out.

Item Event Receivers or way to validate data entered for External List in SharePoint 2010?

Hi everyone,

Are there Item Event Receivers for External List in SharePoint 2010? If not, is there a way to validate the item data entered from External List UI in SharePoint site?


Error loading and running event receiver Microsoft.SharePoint.Workflow.SPWorkflowAutostartEventRecei


Hi all, i found the below error in event log. How can i fix this issue.

Event ID: 6875            Source: Windows SharePoint Services 3

Error loading and running event receiver Microsoft.SharePoint.Workflow.SPWorkflowAutostartEventReceiver in Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c. Additional information is below.

: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

Please help me out in this issue. Thanks in advance.


K2Blackpearl, Sharepoint, .Net

Creating SharePoint 2010 Event Receivers in Visual Studio 2010 (Visual How To)

Watch the video and explore code as you learn to create and deploy an event receiver in Visual Studio 2010.

Sample: Creating SharePoint 2010 Event Receivers in Visual Studio 2010

Explore the code in this visual how-to article as you learn to create and deploy an event receiver in Visual Studio 2010.

Office SharePoint Server Event ID 7082 Error


Hi Guys,

We've got a SharePoint environment consisting of a database server, application server and web server. The details are as below:

Database Server
SQL Standard 2008 SP1 x64

Application Server
Windows Server 2008 R2
SharePoint 2007 SP2 x64
Central Administration
Index Role

Web Server
Windows Server 2008 R2
SharePoint 2007 SP2 x64
Central Administration
Query Role

Everything functions correctly(e.g: search works, logging works) but we keep getting a recurring error on our application log as below (this is on our application server):

Log Name:      Application
Source:        Office SharePoint Server
Date:          14/03/2010 10:40:12 PM
Event ID:      7082
Task Category: Office Server Shared Services
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      serversp.bat.com
An unexpected error occurred while refreshing the shared object manager cache.

Reason: A transport-level error

SharePoint OFfice Server Error (Event ID: 7082)

Hi guys,

I am getting the following error message in my event log. Can anyone please guide me how may I troubleshoot why this issue is being produced ?

Event Type:    Error
Event Source:    Office SharePoint Server
Event Category:    Office Server Shared Services
Event ID:    7082
Date:        12/24/2009
Time:        12:56:58 AM
User:        N/A
Computer:    USSLSSHP001
An unexpected error occurred while refreshing the shared object manager cache.

Reason: This operation returned because the timeout period expired. (Exception from HRESULT: 0x800705B4)

Techinal Details:
System.ApplicationException: This operation returned because the timeout period expired. (Exception from HRESULT: 0x800705B4)
   at System.Threading.ReaderWriterLock.AcquireReaderLockInternal(Int32 millisecondsTimeout)
   at System.Threading.ReaderWriterLock.AcquireReaderLock(Int32 millisecondsTimeout)
   at Microsoft.SharePoint.Utilities.SPInitializeOnceLock..ctor(Boolean readerLock)
   at Microsoft.SharePoint.Utilities.SPInitializeOnceLock.AcquireReaderLock()

Error When am copying Date column from one list to another List using Sharepoint event handlers


when am copying a date column from list A to List B.

am able to copy the the date but, copied date has date decreased by a day!



List A


Date= 11\26\2010


after coping to

List B


Date = 11\25\2010


any thoughts?

 DateTime dt;
            if (properties.AfterProperties["follow_x0020_Date"] != null)

                item["Status follow up date"] = properties.AfterProperties["follow_x0020_Date"].ToString();
                flag = 1;
                dt = Convert.ToDateTime(properties.ListItem["follow_x0020_Date"]);

Sharepoint Designer Custom List Form Error




In sharepoint designer i am editing NEWFORM.aspx for a custom list and adding a custom list form to the page. When i try add item i get a correlation error : "hiding key filters and downgrading tree functionality to legacy ListViewWebPart(v3) level for this list."


Any ideas? Thanks

Event Error 3351 Windows SharePoint Services 3



I have been fighting this error on my WFE/APP Server for the last two weeks and I have followed the guidance from Microsoft but the fix did not help; the error is still there.  I have also researched a fix on the Internet but could not find anything other than the Microsoft fix.  Every morning between 12:45AM and 1:25AM I receive 11 of event ID 3351 errors on my WFE/App server.  While on my DB server I receive five Error 18456.  Every morning same time 7 days a week.

Any suggestions on how to fix the error? 

We have made no know changes to the MOSS configuration.


Event Type: Error
Event Source: Windows SharePoint Services 3
Event Category: Database
Event ID: 3351
Date:  3/6/2008
Time:  12:45:30 AM
User:  N/A
Computer: SERVER
SQL database login failed. Additional error information from SQL Server is included below.

Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

In the SQL Server Logs I receive Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. [CLIENT:  IP ADD

Using Event Receivers in SharePoint Foundation 2010, Part 2

Find practical examples in this article that show you how to use events to enhance your SharePoint applications.

Using Event Receivers in SharePoint Foundation 2010, Part 1

Event receivers in SharePoint Foundation 2010 enable your custom code to respond when specific actions occur on a SharePoint object. Practical examples in this article show you how to use events to enhance your SharePoint applications.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend