AI OnAI Off
Thanks for the feedback. I will try to answer some of your points.
Thanks for the answer, I'll look into it and see if I get it to work now :)
Per,
Thanks for the debugging tip. The reason the notification didn't work was because it couldn't find any formatter ->
2016-01-28 10:14:52,664 [78] WARN EPiServer.Notification.DefaultNotificationDispatcher: No Formatter found for Channel("epi.example")
2016-01-28 10:14:52,678 [78] WARN EPiServer.Notification.DefaultNotificationDispatcher: No Formatter found for Channel("Andreas kanal")
I added a formatter and it sent an email.
You should change this
var notificationRepository = ServiceLocator.Current.GetInstance<INotificationRepository>(); INotificationUser receiver; INotificationUser sender; await notifier.PostNotificationAsync(new NotificationMessage() { ChannelName = "epi.example", Content = "A page has been improved!", Subject = "Improvement", Recipients = new[] { receiver }, Sender sender, TypeName = "PageChanged" });
to
var notifier = ServiceLocator.Current.GetInstance<INotifier>(); INotificationUser receiver; INotificationUser sender; await notifier.PostNotificationAsync(new NotificationMessage() { ChannelName = "epi.example", Content = "A page has been improved!", Subject = "Improvement", Recipients = new[] { receiver }, Sender sender, TypeName = "PageChanged" });
in this guide -> http://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/9/notifications/code-examples/
Thanks for the help!
I have been playing around with the new UserNotification section described here -> http://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/9/notifications/using-notifications/. I haven't used the old Subscriptions and so I can't take anything I have learned from Subscripions to the new UserNotfications. Now here are some thoughts I have
Using the INotificationProvider
If I want to use the Send() method I must provide a list of "ProviderNotificationMessage". The ProviderNotificationMessage class is a concrete class with only getters and no way to set the properties. How am I supposed to be able to send messages if I can't create any?
Why aren't any queued messages sent?
I can see in the tblNotificationMessage there are a lot of unsent messages but when I run the schedualed jobs the only information I get is "Status OK", "Total number of sent messages are 0.". Where can I see why they aren't sent? The only information I can get from the documentation is that messages that couldn't be handled correctly is put back in to the queue.
The Subscriptions part
How will this part work? From what I have seen in the Epi 6 and 7 documentation you need some special properties and pages. Is it still the same or do we have another approach here? From the documentation here -> http://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/9/notifications/subscriptions/, I only know how to add or remove subscriptions but there is not much more about when subscriptions are sent and what else (if any) I have to do to make it work. In the scheduled job I only get "Status ok, 3 user profiles were found. 0 subscription e-mails were sent.". I have updated content on the page but still no emails.
I have some other thoughts about classes and interfaces that are internal but the above thoughts are my most headacing for now. I would really like to get som hints or comments about how to get this new Subscription and UserNotification working! Thanks!
(I understand this is still Beta and code changes between versions)