Skip to content

Instantly share code, notes, and snippets.

@AdamNaj
Last active December 2, 2015 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AdamNaj/7f086cb68d1f2d06cbf0 to your computer and use it in GitHub Desktop.
Save AdamNaj/7f086cb68d1f2d06cbf0 to your computer and use it in GitHub Desktop.
Deep and through republishing workaround, single language
function Publish-Workaround {
[CmdletBinding()]
param(
[Parameter(Position = 0,Mandatory = $true,ValueFromPipeline = $true)]
[ValidateNotNullOrEmpty()]
[Sitecore.Data.Items.Item]$item,
[Parameter(Position = 1,Mandatory = $true,ValueFromPipeline = $true)]
[ValidateNotNullOrEmpty()]
[Sitecore.Data.Database]$target
)
[Sitecore.Publishing.PublishOptions]$po = New-Object -TypeName Sitecore.Publishing.PublishOptions -ArgumentList $item.Database,$target,"Full",$item.Language,([datetime]::Now)
$po.PublishRelatedItems = $true;
$po.RepublishAll = $true;
$po.Deep = $true
$handle = [Sitecore.Publishing.PublishManager]::Publish($po);
if ($handle -ne $null)
{
$publishStatus = [Sitecore.Publishing.PublishManager]::GetStatus($handle);
$publishStatus
}
}
# Usage example - deep and through republishing workaround.
Publish-Workaround (gi master:\content\) (Get-Database "web")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment