Copied to clipboard

Flag this post as spam?

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


  • Nik Wahlberg 639 posts 1237 karma points MVP
    Feb 25, 2010 @ 16:34
    Nik Wahlberg
    0

    Moving a document not updating "Link to document"

    Hi forum,

    hope someone has an idea on this one. I have a process where when a certain document type is published AND it sits in an "unreviewed" queue the node is published and moved to another "folder" (parent node). However, the link to the document still has the unreviewed parent node in it rendering the page as not found on the "front-end". This all happens in the Document_AfterPublish event. I may be answering my own question here, but should I be doing this in Document_BeforePublish? 

    Wanted some input before I push to prod. 

    Thanks all!

    -- Nik

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Feb 25, 2010 @ 17:07
    Dirk De Grave
    1

    Nik,

     

    You should try the AfterDocumentUpdateCache event instead of AfterPublish (Lee has pointed that out not so long ago in a post on this forum)

    Hope this helps.

    Regards,

    /Dirk

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Feb 25, 2010 @ 17:12
    Nik Wahlberg
    0

    Ok, will check that out. Thanks for the pointer Dirk.

    -- Nik

  • jonok 297 posts 657 karma points
    Sep 16, 2010 @ 02:38
    jonok
    0

    This is an old thread but I found a solution that worked for me here - http://our.umbraco.org/wiki/reference/api-cheatsheet/moving-a-document

    You need to add this line of code after you move the document...

    // Tell the published XML content that the document has been moved.
    umbraco
    .library.RefreshContent();
  • Steven Newstead 62 posts 103 karma points
    Jul 11, 2011 @ 11:39
    Steven Newstead
    0

    Hi all,

    Did this get resolved at all? I am doing something similar. On a publish I am moving a node, everything works well except the Link to document and Alternative link. if I republish the site then this works, however if I run this umbraco.library.RefreshContent(); then it does not appear to work.

    I am doing all this work in the AfterPublish event

    Any help greatfully recieved!

    thanks,

    Steve

  • Steven Newstead 62 posts 103 karma points
    Jul 11, 2011 @ 12:06
    Steven Newstead
    0

    Quick update. 

    I'm now trying to call umbraco.library.RefreshContent(); in the AfterUpdateDocumentCache event, but to no avail....

    Any suggestions??

  • jonok 297 posts 657 karma points
    Jul 12, 2011 @ 00:47
    jonok
    0

    Hi Steve,

    I'm calling RefreshContent() in the AfterSave event and its working for me - maybe try it in there? (it still gets called when a node gets published, I think it happens before the publish events)

     

Please Sign in or register to post replies

Write your reply to:

Draft