Showing posts with label WorkflowActions. Show all posts
Showing posts with label WorkflowActions. Show all posts

Monday, December 5, 2016

Find custom action or activity in a designer created 2010 workflow

While cleaning up my SharePoint farm for the cloud migration, i ran into an interesting problem.   If there are custom activity or action created for your designer workflow, how do you track down which ones uses those custom action or activity.

Here is a simple code to go through a site collection that returns all 2010 workflows that is using your custom action/activity that you created with code.

Add-PSSnapin *sharepoint* -ErrorAction SilentlyContinue

$encode = New-Object System.Text.ASCIIEncoding

$site = get-spsite "type in url"

foreach($w in $site.allwebs)
{
    foreach($wf in $w.Lists["workflows"].items)
    {
        if($wf.Name -like "*.xoml")
        {
            $file   = $wf.File
            $data   = $file.OpenBinary()
          
            $test   = $encode.GetString($data)
            if($test.Contains("text to find.  usually the namespace of the assembly of custom dll") -or $test.Contains("more text"))
            {
                  write-host $w.url $wf.Name
            }
        }
    }


Wednesday, June 25, 2014

SharePoint 2010 Custom Workflow Actions in SharePoint 2013

After upgrading the error comes up that the action can not load the class.  

Error:  Could not deserialize object. The type 'MyCustom.WorkflowActions.StartAworkflowOnAnotherList' could not be resolved.

Before in 2010:

<System.Workflow.ComponentModel.WorkflowCompiler>
    <authorizedTypes>
          <authorizedType .....>

In SharePoint 2013 after the upgrade which causes this break:

<System.Workflow.ComponentModel.WorkflowCompiler>
    <authorizedTypes>
      <targetFx version="v4.0">
      </targetFx>
       <authorizedType Assembly="MyCustom.WorkflowActions.StartAworkflowOnAnotherList.....>


To fix:

<System.Workflow.ComponentModel.WorkflowCompiler>
    <authorizedTypes>
      <targetFx version="v4.0">
            <authorizedType Assembly="MyCustom.WorkflowActions.StartAworkflowOnAnotherList.....>
      </targetFx>