From 33d61675f723d6956ec5bef4f63c773097d0dc57 Mon Sep 17 00:00:00 2001 From: Jens Otto Hatlevold Date: Tue, 10 Nov 2020 11:11:27 +0100 Subject: [PATCH 1/2] Fixed error when no workflow service is configured. --- CHANGELOG.md | 5 +++++ .../MSFT_SPWorkflowService.psm1 | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c68108640..a219540bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - SharePointDsc - Added logging to the event log when the code throws an exception +### Fixed + +- SPWorkflowService + - Fixed issue configuring workflow service when no workflow service is currently configured. + ## [4.3.0] - 2020-09-30 ### Added diff --git a/SharePointDsc/DSCResources/MSFT_SPWorkflowService/MSFT_SPWorkflowService.psm1 b/SharePointDsc/DSCResources/MSFT_SPWorkflowService/MSFT_SPWorkflowService.psm1 index 65a0e5d5e..c07b70be2 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWorkflowService/MSFT_SPWorkflowService.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPWorkflowService/MSFT_SPWorkflowService.psm1 @@ -27,7 +27,7 @@ function Get-TargetResource Write-Verbose -Message "Getting the current Workflow Service Configuration(s)" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` + $result = Invoke-SPDSCCommand -Credential $InstallAccount ` -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -51,8 +51,13 @@ function Get-TargetResource if ($null -ne $workflowProxy) { + $workflowHostUri = $workflowProxy.GetHostname($site) + if ($null -ne $workflowHostUri) + { + $workflowHostUri = $workflowHostUri.TrimEnd("/") + } $returnval = @{ - WorkflowHostUri = $workflowProxy.GetHostname($site).TrimEnd("/") + WorkflowHostUri = $workflowHostUri SPSiteUrl = $params.SPSiteUrl ScopeName = $workflowProxy.GetWorkflowScopeName($site) AllowOAuthHttp = $params.AllowOAuthHttp @@ -94,7 +99,7 @@ function Set-TargetResource Write-Verbose -Message "Registering the Workflow Service" ## Perform changes - Invoke-SPDscCommand -Credential $InstallAccount ` + Invoke-SPDSCCommand -Credential $InstallAccount ` -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] From 3db0481e6cecb1502376a91624e0855691d86aaf Mon Sep 17 00:00:00 2001 From: Jens Otto Hatlevold Date: Tue, 10 Nov 2020 11:16:34 +0100 Subject: [PATCH 2/2] Formatting fixes --- .../MSFT_SPWorkflowService/MSFT_SPWorkflowService.psm1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SharePointDsc/DSCResources/MSFT_SPWorkflowService/MSFT_SPWorkflowService.psm1 b/SharePointDsc/DSCResources/MSFT_SPWorkflowService/MSFT_SPWorkflowService.psm1 index c07b70be2..d69c8892d 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWorkflowService/MSFT_SPWorkflowService.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPWorkflowService/MSFT_SPWorkflowService.psm1 @@ -52,10 +52,12 @@ function Get-TargetResource if ($null -ne $workflowProxy) { $workflowHostUri = $workflowProxy.GetHostname($site) + if ($null -ne $workflowHostUri) { $workflowHostUri = $workflowHostUri.TrimEnd("/") } + $returnval = @{ WorkflowHostUri = $workflowHostUri SPSiteUrl = $params.SPSiteUrl