Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jan Vanuytrecht 32 posts 80 karma points
    Dec 23, 2014 @ 13:48
    Jan Vanuytrecht
    0

    IContent UpdateDate different when triggered from Publish button than from SaveAndPublishWithStatus on IContentservice

    Hi,

    We are using Umbraco 7.1.8.

    We currently have some code running in the Examine GatheringNodeData event:

    ExamineManager.Instance.IndexProviderCollection["ExternalIndexer"].GatheringNodeData += [Yourmethod];

    In that method we get the node from the Database:

     

    private void ExamineIndexer_GatheringNodeData(object sender, IndexingNodeDataEventArgs e)
            {
                var node = ApplicationContext.Current.Services.ContentService.GetById(e.NodeId); }

     

    It seems that when this is event is triggered by clicking on the "Save and publish" event the date is incorrect.

    The node's UpdateDate has the local time, but with DateTimeKind "Utc". Thus, is not correct.

     

    When I fire the IContentservice.SaveAndPublishWithStatus event from withing the ContentService's Saved event, the date and time of the node is the same as of the previous trigger, but now with DateTimeKind Local.

    internal void ContentService_Saved(Umbraco.Core.Services.IContentService sender, SaveEventArgs e)
            {
                foreach (var savedEntity in e.SavedEntities)
                {
                            //some code omitted like if statements
    sender.SaveAndPublishWithStatus(savedEntity, 0, false);
    }
            }

    Is this a bug? Or am I doing something worng?

Please Sign in or register to post replies

Write your reply to:

Draft