2

The Publish-Item command appears to use the older API for publishing (slow).

When I run the script below, I do not see the publishing job appear in the Publishing Service dashboard.

$item = Get-Item -Path "master:" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}"
$item | Publish-Item -PublishMode Smart
1
  • I've noticed that Publish-Item uses SPS (at least in my 9.0.1 with SPE 4.7 and 5.0), but if I add the -AsJob flag, it uses the old publisher. I understand why this happens, but it's not very logical since SPS will always be a job.
    – mikaelnet
    Jan 17, 2019 at 14:09

1 Answer 1

6

The Sitecore Publishing Service module replaces the PublishManager API and in most cases should work as you expect. SPE implements the use of the PublishManager but in a way that does not appear to trigger the SPS code.

Below is an example on how to queue publishing jobs to appear in the Publishing Service dashboard.

$database = Get-Database -Name "master"

$item = Get-Item -Path "master:" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}"

$targets = @()
foreach($publishingTarget in [Sitecore.Publishing.PublishManager]::GetPublishingTargets($database)) {
    $targets += Get-Database -Name $publishingTarget[[Sitecore.FieldIDs]::PublishingTargetDatabase]
}

$languages = [Sitecore.Data.Managers.LanguageManager]::GetLanguages($database)

# Item publish with children
[Sitecore.Publishing.PublishManager]::PublishItem($item,$targets,$languages,$true,$true,$true)

# All Items
[Sitecore.Publishing.PublishManager]::PublishSmart($database,$targets,$languages)

Publishing Dashboard

3
  • Can you use the publishing module to publish a set of items together that are unrelated (i.e. not descendants of the root item you want to publish)? Or do you still have to trigger individual jobs to do this? Seems a shame if you can't.
    – theyetiman
    Aug 1, 2019 at 15:14
  • If you are automating this through a script it may not be something to be concerned about. You can use this article as an example of creating a way for the user to bundle items to publish sitecorenutsbolts.net/2015/12/14/…. Even if multiple jobs are created, that's up to Sitecore to worry about. Aug 1, 2019 at 15:24
  • Thanks @Michael West That's an interesting read. I was wondering more about the part that is for Sitecore to worry about with regard to the Publishing Module. (Maybe I stumbled onto the wrong SO question). I've got a task at the moment that creates individual publishes for disparate items, and if you watch the logs in the publishing dashboard you see each one gets an individual manifest built one after the other in sequence. It ends up taking ages when the Publish Module is supposed to be fast. I was hoping the Publish Module would group them into one job and one manifest.
    – theyetiman
    Aug 1, 2019 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.