Partilhar via


Status and Notifications

Applies to: SharePoint Foundation 2010

Microsoft SharePoint Foundation includes a status bar and a notification area on a page. These two areas give information in context without distracting users. Both status messages and notifications are controlled by using the ECMAScript (JavaScript, JScript) object model.

Status Bar

The status bar is used to display persistent information such as the page status or version. It appears as a bar below the Server ribbon and has four predefined background colors that are assigned a level of importance. The status bar can contain multiple messages but will only reflect the color that equates to the highest level of importance, or priority. The message in the status bar is HTML and can contain links or visual elements. The table below describes the color values and their level of importance.

Value

Priority

Red

Very Important

Yellow

Important

Green

Success

Blue

Information

The status bar is accessed by using the JavaScript and server object models. On the server side, you add status messages by using the SPPageStatusSetter class. On the client side, you add status messages by using the SP.UI.Status.addStatus(strTitle, strHtml, atBegining) Method. You can manipulate the status message by using SP.UI.Status.updateStatus(sid, strHtml) Method, SP.UI.Status.removeStatus(sid) Method, SP.UI.Status.setStatusPriColor(sid, strColor) Method, and SP.UI.Status.removeAllStatus(hide) Method.

Important

SP.UI.Status.removeAllStatus(hide) Method should be used with caution. This method will remove status messages that were added from outside of your code.

Notifications

Notifications are used to show transitory messages such as the status of an operation on the page. Notifications appear on the right side of the page underneath the ribbon. By default, the message is visible for 5 seconds. When adding the notification to the page, you can specify that you want the message to stay on the page longer than 5 seconds. The message in the notification is HTML and can contain links or visual elements. Notifications are added by using the JavaScript object model. You can add a notification by using the SP.UI.Notify.addNotification(strHtml, bSticky) Method and remove a notification by using the SP.UI.Notify.removeNotification(nid) Method.