Click or drag to resize

NotificationsItemSaved Field

Occurs after the news item has been saved.

Namespace:  Dynamicweb.News
Assembly:  Dynamicweb.News (in Dynamicweb.News.dll) Version: 1.0.10
Syntax
public const string ItemSaved = "DWN_MODULES_NEWSV2_ITEMSAVED"

Field Value

Type: String
Remarks
Examples
Example
[Dynamicweb.Extensibility.Subscribe(Dynamicweb.Notifications.NewsV2.ItemSaved)]
    public class NewsV2ItemSavedObserver : Dynamicweb.Extensibility.NotificationSubscriber
    {
        public override void OnNotify(string notification, Dynamicweb.Extensibility.NotificationArgs args)
        {
            if (args == null)
                return;

            if (!(args is Dynamicweb.NewsV2.Extensibility.NewsItemNotificationArgs))
                return;

            Dynamicweb.NewsV2.Extensibility.NewsItemNotificationArgs news = (Dynamicweb.NewsV2.Extensibility.NewsItemNotificationArgs)args;

            news.Item.NewsAuthor = "me";
            news.Item.Save();
        }
    }
See Also