Dynamicweb 8 Documentation
Removed Field (Module)
Example 

Event occurs after the module was deleted
Syntax
'Declaration
 
Public Const Removed As String
public const string Removed
Example
Overriding notification of the module removingOverriding notification of the module removing
namespace Dynamicweb.Examples.CSharp.Notifications
{
    [Dynamicweb.Extensibility.Subscribe(Dynamicweb.Notifications.Module.Removed)]
    public class ModuleRemovedObserver : Dynamicweb.Extensibility.NotificationSubscriber
    {
        public override void OnNotify(string notification, Dynamicweb.Extensibility.NotificationArgs args)
        {
            if (args == null)
            {
                return;
            }

            var loadedArgs = (Dynamicweb.Notifications.Module.RemovedArgs)args;

            // Get module, which has been removed
            Dynamicweb.Modules.Module module = loadedArgs.Module;

            // Pass module name to the notification email
            string emailBody = string.Format("The module '{0}' has been removed.", module.Name);
            Dynamicweb.Modules.Common.Email.SendMail("user name", "username@somedomain.dk", "ModuleRemovedObserver", "admin", "noreply@dynamicweb.dk", emailBody, "UTF-8");
        }
    }
}
Namespace Notifications
    <Extensibility.Subscribe(Global.Dynamicweb.Notifications.Module.Removed)> _
    Public Class ModuleRemovedObserver
        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

            Dim loadedArgs As Global.Dynamicweb.Notifications.Module.RemovedArgs = DirectCast(args, Global.Dynamicweb.Notifications.Module.RemovedArgs)

            ' Get module, which has been added
            Dim removedModule As Global.Dynamicweb.Modules.Module = loadedArgs.Module
        End Sub

    End Class
End Namespace
Remarks
The passed NotificationArgs is Module.RemovedArgs
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

Module Class
Module Members

Send Feedback