With the new version of SharePoint comes a full set of new and awesome features that you’ll have to indulge and learn. One of the small things that makes my day much more fun is to display messages to your users in the Status- and Notification areas.
Example of a message in the Status bar area:

Example of a message in the Notification area:

How do we make this magic happen?
In order to display these messages, you really (really) don’t need a lot of code. I’ll lay out the simple code I used to display the messages you saw in my screenshots.
It’s all JavaScript based, so get ready to dig out those old JS skills you know you’ve got lying around somewhere ;-)
Oh wait, you don’t need skills to do this, it’s just that easy!
Show me a Status bar!
function ShowStatusBarMessage(title, message)
{
var statusId = SP.UI.Status.addStatus(title, message, true);
SP.UI.Status.setStatusPriColor(statusId, ‘yellow’); /* Set a status-color */
}
Edit 2020: Unfortunately, the
HTMLsnippets of this blog didn’t make the blog migration.
Show me a Notification popup!
function ShowNotificationMessage(tooltip, message, sticky)
{
SP.UI.Notify.addNotification(message, sticky, tooltip, null);
}
Edit 2020: Unfortunately, the
HTMLsnippets of this blog didn’t make the blog migration.
Summary
Actually, there’s no need for a summary. It’s way too easy.
Enjoy!
Comments are closed
Archived comments
Good through.
How can i integrate this with a list ?
For example display a message when there is a new item.
Cheers
Hi : Tobias Zimmergren,
How do we alert and display a message whenever a new list item is added in sharepoint dynamically
Create an event receiver to do this when a new item is created
Hi Same as Naijacoder, how can i create a notification to all my users when a new item has been created?
Where do you put this code? I've no idea and showing this would be very helpful.
Hi Andrew,
You can put it in various places, for example in a script file that your applications call to show dialogs or why not in a Content Editor Web Part and have your application call it from there.
Regards,
Tobias.