Publish all SharePoint workflows from Powershell

Sviatoslav Bulash -

$web = Get-SPWeb http://sp13clean/es
$username = "domain\user"
$password = "password"
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))
$URI = "http://sp13clean/_vti_bin/webpartpages.asmx"
$proxy = New-WebServiceProxy -Uri $URI -Credential $cred
Try {
$subFolders = $web.Folders["Workflows"].SubFolders;
foreach($folder in $subFolders)
{
if($folder.Name -ne "Forms")
{
$xomlConfigFile = $folder.Files[$folder.Name+".xoml.wfconfig.xml"]
# The web service proxy sets the URL to root, so we reset it to the subsite
$proxy.Url = $web.Url+"/_vti_bin/webpartpages.asmx"
$result = $proxy.AssociateWorkflowMarkup($xomlConfigFile.Url,"V"+$xomlConfigFile.UIVersionLabel)
Write-Host $result
}
}
}
Catch {$folder.Name}
$web.Dispose()

 

Have more questions? Submit a request

Comments

Powered by Zendesk