Fetch SharePoint Workflow Manager 1.0 Scopes

Workflow Manager Scopes

SQL Query

You can use following SQL Query on WFResourceManagementDB and it will list down all the workflow scopes created by Workflow Manager with Subsite URL and Scope path:


;WITH XMLNAMESPACES ('http://schemas.microsoft.com/workflow/2012/xaml/activities' AS ns)
SELECT XC.value('ns:Value[1]','varchar(150)') AS WScope,
S.Path,
S.DefaultWorkflowConfiguration,
S.Description
FROM [WFResourceManagementDB].[dbo].[Scopes] S
CROSS APPLY S.DefaultWorkflowConfiguration.nodes('/ns:ScopedWorkflowConfiguration/ns:appSettings/ns:AppSetting') as XT(XC)
WHERE XC.value('ns:Key[1]','varchar(100)') LIKE '%WebUrl'
Order By 1



PowerShell Method

You can use below PowerShell script to fetch all the scopes:


[string]$Endpoint='http://wfservername:12291'
[string]$Path = '/'
[string]$Parent = "None"

[Reflection.Assembly]::Load("Microsoft.Workflow.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35") | Out-Null
Write-Output ""

function WriteScopeInfo([string]$scopeUri, [string]$path, [string]$parent) {
    $scopePath = $scopeUri + $path
    $client = New-Object -TypeName "Microsoft.Workflow.Client.WorkflowManagementClient" -ArgumentList $scopePath
    $manager = $client.CurrentScope
    $scope = $manager.Get()
   
    Write-Host "Name: `t`t`t$($scope.DisplayName)"
    Write-Host "Path: `t`t`t$($scope.Path)"
    Write-Host "Status: `t`t$($scope.Status.ToString())"
    Write-Host "User Comments: `t$($scope.UserComments)"
    Write-Host "Parent: `t`t$parent"
    Write-Host "Children: `t`t$($scope.ChildScopeCount)"

    [Microsoft.Workflow.Client.WorkflowConfiguration]$wfConfig = $scope.DefaultWorkflowConfiguration
    if($wfConfig.AppSettings -ne $null){
        $appSettings = $wfConfig.AppSettings.GetEnumerator() | Where {$_.Key -eq "Microsoft.SharePoint.ActivationProperties.WebUrl"};     
        Write-Host "DefaultWorkflowConfiguration: `t`t$($appSettings.Value)"
    }
    Write-Host ""

    if ($scope.ChildScopeCount -gt 0) {
        $manager.GetChildScopes() | % { WriteScopeInfo $scopeUri $_.Path $scope.Path }
    }   
}

WriteScopeInfo $Endpoint $Path $Parent



Comments

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete

Post a Comment

Popular posts from this blog

Installation and Configuration of Office Online Server with SharePoint 2019

Workflow Manager 1.0- Installation, Configuration and Issues

SharePoint 2013- Add new server to Farm and Configuring Services