DNN

Snippets

21

You can use NotificationsController.Instance.SendNotification method to send notifications.

Here is an example:

 

        public void AddHtmlNotification(string subject, string body)
        {
           
            UserInfo _currentUser = DotNetNuke.Entities.Users.UserController.GetUserById(this.PortalId, PortalSettings.AdministratorId);
            var notificationType = NotificationsController.Instance.GetNotificationType("HtmlNotification");
            // NEED THE PORTALID HERE AND AGENTID
            var sender = UserController.GetUserById(this.PortalId, this.UserId);
            var notification = new Notification { NotificationTypeID = notificationType.NotificationTypeId, Subject = subject, Body = body, IncludeDismissAction = true, SenderUserID = sender.UserID };
            NotificationsController.Instance.SendNotification(notification, this.PortalId, null, new List { _currentUser });
        }

 

Comments

There are currently no comments, be the first to post one!

Post Comment

Only registered users may post comments.