Copied to clipboard

Flag this post as spam?

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


  • Paul Seal 524 posts 2889 karma points MVP 6x c-trib
    May 07, 2019 @ 13:45
    Paul Seal
    0

    How do I use the Content Service to publish a node and all of its descendants in v8

    Hi

    In an Umbraco v8 site, I have a node which is published but it has many child nodes and descendants which are not yet published. I would like to use the content service to publish them all in one command.

    How do I do this please?

    Thanks

    Paul

  • Kevin Jump 2310 posts 14695 karma points MVP 7x c-trib
    May 07, 2019 @ 14:02
    Kevin Jump
    104

    Hi Paul,

    i believe it's `SaveAndPublishBranch' now.

    /// <summary>
    /// Saves and publishes a document branch.
    /// </summary>
    /// <param name="content">The root document.</param>
    /// <param name="force">A value indicating whether to force-publish documents that are not already published.</param>
    /// <param name="culture">A culture, or "*" for all cultures.</param>
    /// <param name="userId">The identifier of the user performing the operation.</param>
    /// <remarks>
    /// <para>Unless specified, all cultures are re-published. Otherwise, one culture can be specified. To act on more
    /// than one culture, see the other overloads of this method.</para>
    /// <para>The <paramref name="force"/> parameter determines which documents are published. When <c>false</c>,
    /// only those documents that are already published, are republished. When <c>true</c>, all documents are
    /// published. The root of the branch is always published, regardless of <paramref name="force"/>.</para>
    /// </remarks>
    IEnumerable<PublishResult> SaveAndPublishBranch(IContent content, bool force, string culture = "*", int userId = Constants.Security.SuperUserId);
    
  • Dmitriy 168 posts 588 karma points
    Feb 26, 2020 @ 09:29
    Dmitriy
    0

    By the way, How it does in Umbraco 7? :)

  • Paul Seal 524 posts 2889 karma points MVP 6x c-trib
    May 07, 2019 @ 14:06
    Paul Seal
    0

    Thanks Kevin

Please Sign in or register to post replies

Write your reply to:

Draft