Last active
December 2, 2015 15:44
-
-
Save AdamNaj/7f086cb68d1f2d06cbf0 to your computer and use it in GitHub Desktop.
Deep and through republishing workaround, single language
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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