Copied to clipboard

Flag this post as spam?

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


  • Jonas Nilsson 137 posts 260 karma points
    Jun 04, 2014 @ 15:15
    Jonas Nilsson
    0

    Umbraco 7.1 and ContentService.Published

    I use the Published event in Umbraco ContentService, and everything is working fine when saving/publish an existing node.
    But if I create a new node and save/publish it, I can't get the published node as an DynamicNode (n is null)
    (I need to get the whole structure of the published node)

    void ContentService_Published(IPublishingStrategy sender, PublishEventArgs<IContent> e)
    {
    foreach (var node in e.PublishedEntities)
            {
            DynamicNode n = new DynamicNode(node.Id);  // Works with existing nodes, but not when creating a new one. (the new id exists in node.Id)

     


  • Charles Afford 1163 posts 1709 karma points
    Jun 08, 2014 @ 12:27
    Charles Afford
    0

    Hi, could you expalin a bit more what you are trying to do?  i am confused.  is the problem you cannot get your node as DynamicNode after createing a new node using the content service

  • Jonas Nilsson 137 posts 260 karma points
    Jun 08, 2014 @ 12:43
    Jonas Nilsson
    0

    Yes, that's the problem, but I solved it by using the ParentId of the created/published node to create a DynamicNode, so I could use Linq and get some properties from the a level 2 node.

    Does it have something to do with the cache not updated before the Published event (DynamicNode uses the cache).

    /Jonas

  • Charles Afford 1163 posts 1709 karma points
    Jun 08, 2014 @ 19:31
    Charles Afford
    0

    Yea you have got it its the cache not being updated.  You can use UpdateCache() method (i think thats the name).  There is a bug in one of the version but dont know which this is :).

    Charlie :)

Please Sign in or register to post replies

Write your reply to:

Draft