Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have an event receiver, which fires when item is being deleted ( ItemDeleting event ). I have some logic that checks whether item can be deleted or not, and if it can't, I need to show notification message - reason why item can't be deleted.

Now I would like to use SharePoint notifications, to have notification appear on the upper right corner, under the ribbons panel.

Any ideas how can I do that ? Or is it even possible ?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

The only way you can get the call of the Javascript from the EventReceiver to the browser is through the SPEventPropertiesBase.RedirectUrl, but unfortunately you can't just specify javascript:... so you may have to:

  • Add something to your master page looking for a query parameter and showing the notification if that query parameter is present
  • In the EventReceiver set RedirectUrl to the original Url + the special query parameter

You should check it this code works as you want in all scenarios like when the users open an item in a dialog box (view/edit) and clicks delete, ...

share|improve this answer
    
Thanks, interesting approach. Requires few more cases to track ( as you mentioned, if user opens up dialog and deletes item from there ), but seems the only way to do that. –  michael moore Sep 3 '12 at 7:27
add comment

you might like to have a look at the below links, which should solve your purpose!

http://www.c-sharpcorner.com/uploadfile/anavijai/programmatically-creating-alerts-in-sharepoint-2010/

http://www.spdeveloper.co.in/articles/pages/notificationsnstatus.aspx

share|improve this answer
    
Thanks for links, I don't think alerts would work for me, what I intended to use is notifications, and second link you've provided is all about it, thou I'm looking for a way to use it from Event Receiver. –  michael moore Sep 2 '12 at 15:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.