Beyond working with status information, you can also customize the Notification Area on the upper right-hand side of the screen below the Ribbon. The Notification Area helpfully tells users such useful information as that a page is loading, or that a save was successful. Prior to SharePoint 2010, this sort of information was indicated a postback and page refresh. In this article, we will take a look at how to show a message in the Notification Area in SharePoint 2010.
Challenge:
How can I show a message in the Notification Area in SharePoint 2010?
Solution:
A Notification appears in a small text area which gets displayed at the top-right corner of the window, while performing actions such as saving a page, checking out a page, etc., and is similar to the notification Gmail users see when sending an email. The Notification Area is a simple text area with a pale yellow background and a dark yellow border, as shown in the screenshot below. This is a new feature in SharePoint 2010.
The Notification Area can display one or more messages. Depending on the setting, a message will either disappear automatically or be disposed the developer manually.
How to use it?
Working with the Notification Area is really easy. The SharePoint team has done great job and wrapped up all of the functionality into the SP.UI.Notify namespace.
The first function is the SP.UI.Notify.addNotification function which takes two arguments: the HTML message to be displayed and a boolean value that determines whether the message is sticky or not:
SP.UI.Notify.addNotification = function(message, bSticky) {
}
Sticky notification messages have to be disposed of manually calling the SP.UI.Notify.removeNotification function and passing the ID of the message to dispose.
For example, executing the following call:
var notifyId = SP.UI.Notify.addNotification("Do You Bamboo?", true);
The following sticky notification message will be displayed:
The cool thing about the notification messages is that they can contain HTML and allow you to include images or links to deliver richer feedback to the users.
Remove Notification Area
By default, notification messages disappear automatically after five seconds. This value is hard-coded and cannot be modified. However, you also have the ability to display sticky messages, and you may control when these messages disappear.
You can hide notification messages using the SP.UI.Notify.removeNotification message. The only parameter that it takes is the ID of the notification message to hide:
SP.UI.Notify.removeNotification = function(notifyId) {
}
Notification messages are a great way to deliver feedback to users, communicating the execution of an operation. The SharePoint 2010 UI API makes it extremely easy to use notification messages in your custom applications developed on the SharePoint platform.
Notes:
- See the attachment for the source code and script of this example.
See Also:
SharePoint Online
The cloud parts are functional components that extend your SharePoint Online environment in Microsoft 365.
Supports Classic and Modern sites for SharePoint Online/Microsoft 365
Small Business Pricing and Discounts
SharePoint
Top SharePoint Online Products
Experience greater power and savings by bundling our SharePoint apps and cloud parts.
On-Premises Only
These web parts extend SharePoint beyond its out-of-the-box capabilities by tailoring it to your requirements with Bamboo Solution’s growing portfolio of SharePoint Web Parts.
SharePoint 2016, 2019, 2022 – Classic Pages Only
SharePoint
Top On-Premises Only Products
Experience greater power and savings by bundling our SharePoint apps and web parts.
Our team of Microsoft 365 Technology Consultants helps you get the most out of your Microsoft technology, we have the best Microsoft 365 talent to streamline your organization.
Consulting to Streamline Your Department
M365 Plus
Managed Services
Microsoft 365
Consulting to Streamline Your Department
Our Consultants Have What You Need
Federal Contractors
Microsoft 365
Our Consultants Have What You Need