Dynamicweb 8 Documentation
Started Field
Example 

Admin started notification. Occurs after the user logged in and got to the website Administration.
Syntax
'Declaration
 
Public Const Started As String
public const string Started
Example
Overriding the admin started notification in DynamicwebOverriding the admin started notification in Dynamicweb
namespace Dynamicweb.Examples.CSharp.Notifications.Standard
{
    [Dynamicweb.Extensibility.Subscribe(Dynamicweb.Notifications.Standard.Admin.Started)]
    public class AdminStartedObserver : Dynamicweb.Extensibility.NotificationSubscriber
    {
        public override void OnNotify(string notification, Dynamicweb.Extensibility.NotificationArgs args)
        {
            if (args == null)
                return;

            if (!(args is Dynamicweb.Notifications.Standard.Admin.StartArgs))
                return;

            Dynamicweb.Notifications.Standard.Admin.StartArgs item = (Dynamicweb.Notifications.Standard.Admin.StartArgs)args;

            Dynamicweb.Modules.UserManagement.User user = Dynamicweb.Modules.UserManagement.User.GetCurrentUser();

            //Pass user name to the notification e-mail
            string emailBody = string.Format("The user ({0}) has been logged-in.", user.Name);
            Dynamicweb.Modules.Common.Email.SendMail("user name", "username@somedomain.dk", "AdminStartedObserver",
                "admin", "noreply@dynamicweb.dk", emailBody, "UTF-8");
        }
    }
}
Namespace Notifications.Standard
    <Extensibility.Subscribe(Global.Dynamicweb.Notifications.Standard.Admin.Started)> _
    Public Class AdminStartedObserver
        Inherits Global.Dynamicweb.Extensibility.NotificationSubscriber

        Public Overrides Sub OnNotify(ByVal notification As String, ByVal args As Global.Dynamicweb.Extensibility.NotificationArgs)
            If args Is Nothing Then
                Return
            End If

            If Not (TypeOf args Is Global.Dynamicweb.Notifications.Standard.Admin.StartArgs) Then
                Return
            End If

            Dim item As Global.Dynamicweb.Notifications.Standard.Admin.StartArgs = DirectCast(args, Global.Dynamicweb.Notifications.Standard.Admin.StartArgs)

            Dim user As Global.Dynamicweb.Modules.UserManagement.User = Global.Dynamicweb.Modules.UserManagement.User.GetCurrentUser()

            'Pass user name to the notification e-mail
            Dim emailBody As String = String.Format("The user ({0}) has been logged-in.", user.Name)
            Global.Dynamicweb.Modules.Common.Email.SendMail("user name", "username@somedomain.dk", "AdminStartedObserver", "admin", "noreply@dynamicweb.dk", emailBody, "UTF-8")
        End Sub

    End Class
End Namespace
Remarks
The passed NotificationArgs is Dynamicweb.Notifications.Standard.Admin.StartArgs
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

Standard.Admin Class
Standard.Admin Members

Send Feedback