Copied to clipboard

Flag this post as spam?

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


  • Rigo 15 posts 45 karma points
    Nov 15, 2014 @ 16:26
    Rigo
    0

    Detecting if there is a newer, unpublished version of a node

    Hi

    I should update nodes via API (Umbraco 7.1.9). Therefore I need to find out if there is a newer still unpublished version of a specific node, because I don't want to publish content which shouldn't be online yet. If there is no newer unpublished version, publishing the updated node is ok.

    I unsuccessfully searched for methods of the Umbraco-API:

    • detecting if there is a newer and unpublished version
    • getting the newer and unpublished version which I could update and save

    Would anyone be so kind to give me a hint?

    Thank you
    Rigo

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Nov 15, 2014 @ 18:20
    Jan Skovgaard
    0

    Hi Rigo

    Before I just point you to the API reference I just want to know where you have looked / what you have found so far? It can be a bit hard to keep track of all the documentation and where it's placed on this site sometimes.

    Looking forward to hearing from you.

    /Jan

  • Rigo 15 posts 45 karma points
    Nov 15, 2014 @ 19:17
    Rigo
    0

    Hi Jan

    You again :-)

    I found nothing specific and got a litte bit lost. Perhaps it might help if I tell you what I intend to do.

    I'm planning to code some kind of Tag-Dashboard in the backend where I can list all the tags. It should be possible to rename a tag or delete it.

    Before I delete or rename the tag I would do a search for all content-nodes that have been tagged with this one ( UmbracoHelper.TagQuery.GetContentByTag("xyz") ). So far no problem.

    When looping through all found content-nodes, I want to check if there is newer not yet published content (newer version) for this specific node. If not, I would remove the tag (changing the content of the field of data type "tag") and save and publish the content-node. If there is newer and unpublished content, I want to update the field and only save (but not publish) the newer version ot the node.

    I hope this helps. Thank you for your support.
    Rigo

    Edit
    Maybe I didn't get the point. I found this method:

    umbraco.cms.businesslogic.Tags.Tag.RemoveTagFromNode(pageid, tagname, groupname);
    

    Could it be that just be calling this method, I don't have to touch the node itself and therefore there would be no problem with published/newer version?

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Nov 16, 2014 @ 07:21
    Jan Skovgaard
    100

    Hi Rigo

    Yup, me again :)

    Ok, but you can find the documentation for the management API's in v7 here http://our.umbraco.org/documentation/Reference/Management-v6/ (Don't get fooled about that is says "v6" in the title, it's the same underlying API in 7).

    I suspect that you need to have a further look in the ContentService, which you can find more information about here http://our.umbraco.org/documentation/Reference/Management-v6/Services/ContentService

    You might also need to hook your code up on certain evens so if you do you can see the possible events here http://our.umbraco.org/documentation/reference/Events-v6/

    I hope this helps :)

    /Jan

  • Rigo 15 posts 45 karma points
    Nov 16, 2014 @ 11:38
    Rigo
    0

    Hi Jan

    That looks promising. I will have a look a it.

    Thank you again for your 24/7 support!

    Rigo

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Nov 16, 2014 @ 15:14
    Jan Skovgaard
    0

    Hi Rigo

    You're welcome, trying to do my best to help people out when time allows me :)

    Hope you figure things out based on those links.

    Cheers, Jan

Please Sign in or register to post replies

Write your reply to:

Draft