Developer forum
E-mail notifications
NotificationSubscriber
Replies
My code works fine - Apparently I'm just can't get all the notifications to work :-S
I can't seem to get any other than Dynamicweb.Notifications.Standard.Application.Start and Dynamicweb.Notifications.Standard.Admin.Started to work.
Is there any doc on what the different notifications react on.
I have tried to subscribe to Dynamicweb.Notifications.ExtranetExtended.User.Created but without any luck. I even can't get Dynamicweb.Notifications.Standard.Page.Loaded to work - I asume that it's called every time a page is loaded.
- Lars
Hi Lars,
At http://engage.dynamicweb-cms.com/Development-200.aspx you will find documentation on the notification subscribers.
For the notification to work, you should simply have the assembly (dll) you're creating in the \bin folder of the application, which your solution is using.
Please let me know if you have succes or not.
Regards /Snedker
using Dynamicweb;
using Dynamicweb.Notifications;
using Dynamicweb.Extensibility;
using System;
[Subscribe(Dynamicweb.Notifications.Standard.Application.Start)]
public class ApplicationStarted : NotificationSubscriber
{
public override void OnNotify(string notification, NotificationArgs args)
{
Base.wa("ApplicationStarted");
Base.WriteTextFile("ApplicationStarted ", "c:\\transport\\log.txt", true);
}
}
[Subscribe(Dynamicweb.Notifications.Standard.Page.Loaded)]
public class PageLoaded : NotificationSubscriber
{
public override void OnNotify(string notification, NotificationArgs args)
{
//Base.wa("PageLoaded");
Base.WriteTextFile("PageLoaded ", "c:\\transport\\log.txt", true);
}
}
[Subscribe(Dynamicweb.Notifications.Standard.Admin.Started)]
public class AdminStarted : NotificationSubscriber
{
public override void OnNotify(string notification, NotificationArgs args)
{
//Base.wa("AdminStarted");
Base.WriteTextFile("AdminStarted ", "c:\\transport\\log.txt", true);
}
}
[Subscribe(Dynamicweb.Notifications.ExtranetExtended.User.Created)]
public class UserCreated : NotificationSubscriber
{
public override void OnNotify(string notification, NotificationArgs args)
{
//Base.wa("UserCreated");
Base.WriteTextFile("UserCreated ", "c:\\transport\\log.txt", true);
}
}
- Lars
For the older version of user management use:
Dynamicweb.Notifications.ExtranetExtended.User.Created
With the new version - you should have a look at "User Management Extensibility API" found here http://engage.dynamicweb-cms.com/Development-200.aspx
The notification are now:
[
Subscribe(Dynamicweb.Modules.UserManagement.Notifications.UserSaved), Subscribe(Dynamicweb.Modules.UserManagement.Notifications.UserDeleted)
]
###
"There is a property on the user object called "IsNew". This property contains a boolean value indicating whether this user has been saved before. Checking this on UserSaved notification should give you what you need."
From:
http://engage.dynamicweb-cms.com/Forum-5.aspx?action=ShowThread&ThreadID=1944
The problem is probably not with the Subscribe attribute and the string you're passing to it, but with the version of the OnNotify method you're overriding. Newer notifications call the one that accept a NotificationArgs instance, while older ones called the overload that accepts an object[]:
public override void OnNotify(string notification, object[] args)Hope this helps,
{
}
Imar
You must be logged in to post in the forum