Wednesday, November 16, 2011

Adding Notification and Status in SharePoint through Client Object Model

<script language="ecmascript" type="text/ecmascript">
var statusId = '';
var notifyId = '';
function AddNotification() {
    notifyId = SP.UI.Notify.addNotification("Hello World!", true);
}
function RemoveNotification() {
    SP.UI.Notify.removeNotification(notifyId);
    notifyId  = '';
}
function AddStatus() {
    statusId = SP.UI.Status.addStatus("Status good!");
    SP.UI.Status.setStatusPriColor(statusId, 'red');
}
function RemoveLastStatus() {
    SP.UI.Status.removeStatus(statusId);
    statusId = '';
}
function RemoveAllStatus() {
    SP.UI.Status.removeAllStatus(true);
}
</script>
<input id="Button1" onclick="AddNotification()" type="button" value="Add Notification"/>
<input id="Button2" onclick="RemoveNotification()" type="button" value="Remove Notification"/>
<input id="Button3" onclick="AddStatus()" type="button" value="Add Status"/>
<input id="Button4" onclick="RemoveLastStatus()" type="button" value="Remove Last Status"/>
<input id="Button5" onclick="RemoveAllStatus()" type="button" value="Remove All Status"/>

No comments:

Post a Comment

How to launch a document by clicking a link to the file?

Word: <a href='ms-word:ofe|u|path/to/web/word/document.docx'>Link to document</a> Excel: <a href='ms-excel:o...