Pergunta

I have created a simple SP 2013 workflow in Visual Studio 2012. I configured it through the wizard to attach to a specific list. I am using a VM with windows server 2012, SP2013 in a standalone environment, and workflow manager. The solution deploys fine to SP and is activated, but does not get attached to the list. I went through the log files and found this:

Not enough information to determine a list for module "GuitarWorkflow". Assuming no list for this module.

Here is my elements/xaml contents:

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="GuitarWorkflow" Url="wfsvc/9fdef811d07146f6a4153dbf70de81b0">
    <File Url="WorkflowStartAssociation" Path="GuitarWorkflow\WorkflowStartAssociation" Type="Ghostable">
      <Property Name="WSDisplayName" Value="GuitarWorkflow - Workflow Start" />
      <Property Name="ContentType" Value="WorkflowServiceSubscription" />
      <Property Name="WSPublishState" Value="3" />
      <Property Name="WSEventType" Value="WorkflowStart" />
      <Property Name="WSEnabled" Value="true" />
      <Property Name="WSGUID" Value="d68c7819-fd0c-4cb3-9537-bc099cc42e2e" />
      <Property Name="WSEventSourceGUID" Value="{$ListId:Lists/Guitars;}" />
      <Property Name="Microsoft.SharePoint.ActivationProperties.ListId" Value="{$ListId:Lists/Guitars;}" />
      <Property Name="HistoryListId" Value="{$ListId:Lists/Workflow History;}" />
      <Property Name="RestrictToScope" Value="{$ListId:Lists/Guitars;}" />
      <Property Name="TaskListId" Value="(None)" />
    </File>
    <File Url="ItemAddedAssociation" Path="GuitarWorkflow\ItemAddedAssociation" Type="Ghostable">
      <Property Name="WSDisplayName" Value="GuitarWorkflow - Item Added" />
      <Property Name="ContentType" Value="WorkflowServiceSubscription" />
      <Property Name="WSPublishState" Value="3" />
      <Property Name="WSEventType" Value="ItemAdded" />
      <Property Name="WSEnabled" Value="true" />
      <Property Name="WSGUID" Value="4aa20a2f-81d0-41eb-b93d-a2d22b8b5e49" />
      <Property Name="WSEventSourceGUID" Value="{$ListId:Lists/Guitars;}" />
      <Property Name="Microsoft.SharePoint.ActivationProperties.ListId" Value="{$ListId:Lists/Guitars;}" />
      <Property Name="HistoryListId" Value="{$ListId:Lists/Workflow History;}" />
      <Property Name="RestrictToScope" Value="{$ListId:Lists/Guitars;}" />
      <Property Name="TaskListId" Value="(None)" />
    </File>
    <File Path="GuitarWorkflow\Workflow.xaml" Url="GuitarWorkflow/Workflow.xaml" >
      <Property Name="RestrictToScope" Value="{$ListId:Lists/Guitars;}" />
      <Property Name="RestrictToType" Value="List" />
    </File>
  </Module>
  <ListInstance FeatureId="{2c63df2b-ceab-42c6-aeff-b3968162d4b1}"
                TemplateType="4501"
                Title="wfsvc"
                Description="This list instance is used by SharePoint to keep track of workflows. Do not modify."
                Url="wfsvc"
                RootWebOnly="FALSE" />
</Elements>

Here is my workflow xaml:

<Activity mc:Ignorable="sap sap2010 sads" x:Class="GuitarWorkflow.GuitarWorkflow.Workflow" sap2010:ExpressionActivityEditor.ExpressionActivityEditor="C#" sap2010:WorkflowViewState.IdRef="GuitarWorkflow.GuitarWorkflow.Workflow_1"
 xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities"
 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 xmlns:mca="clr-namespace:Microsoft.CSharp.Activities;assembly=System.Activities"
 xmlns:msdad="clr-namespace:Microsoft.SharePoint.DesignTime.Activities.Design;assembly=Microsoft.SharePoint.DesignTime.Activities.Design"
 xmlns:p="http://schemas.microsoft.com/workflow/2012/07/xaml/activities"
 xmlns:p1="wf://workflow.windows.net/$Activities"
 xmlns:s="clr-namespace:System;assembly=mscorlib"
 xmlns:sads="http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger"
 xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation"
 xmlns:sap2010="http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation"
 xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib"
 xmlns:sco="clr-namespace:System.Collections.ObjectModel;assembly=mscorlib"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <TextExpression.NamespacesForImplementation>
    <sco:Collection x:TypeArguments="x:String">
      <x:String>System</x:String>
      <x:String>System.Collections.Generic</x:String>
      <x:String>System.Data</x:String>
      <x:String>System.Text</x:String>
      <x:String>System.Collections.ObjectModel</x:String>
    </sco:Collection>
  </TextExpression.NamespacesForImplementation>
  <TextExpression.ReferencesForImplementation>
    <sco:Collection x:TypeArguments="AssemblyReference">
      <AssemblyReference>Microsoft.Activities</AssemblyReference>
      <AssemblyReference>Microsoft.SharePoint.DesignTime.Activities</AssemblyReference>
      <AssemblyReference>PresentationFramework</AssemblyReference>
      <AssemblyReference>System</AssemblyReference>
      <AssemblyReference>System.Activities</AssemblyReference>
      <AssemblyReference>System.Core</AssemblyReference>
      <AssemblyReference>System.Data</AssemblyReference>
      <AssemblyReference>System.Drawing</AssemblyReference>
      <AssemblyReference>System.Runtime.Serialization</AssemblyReference>
      <AssemblyReference>System.ServiceModel.Activities</AssemblyReference>
      <AssemblyReference>System.Xaml</AssemblyReference>
      <AssemblyReference>System.Xml</AssemblyReference>
      <AssemblyReference>System.Xml.Linq</AssemblyReference>
      <AssemblyReference>Microsoft.SharePoint</AssemblyReference>
      <AssemblyReference>Microsoft.SharePoint.Client.ServerRuntime</AssemblyReference>
      <AssemblyReference>mscorlib</AssemblyReference>
      <AssemblyReference>GuitarWorkflow</AssemblyReference>
    </sco:Collection>
  </TextExpression.ReferencesForImplementation>
  <Sequence sap2010:WorkflowViewState.IdRef="Sequence_1">
    <Sequence.Variables>
      <Variable x:TypeArguments="p:DynamicValue" Name="dv_0" />
      <Variable x:TypeArguments="x:String" Name="GuitarType">
        <Variable.Default>
          <mca:CSharpValue x:TypeArguments="x:String">dv_0["Guitar Type"].ToString()</mca:CSharpValue>
        </Variable.Default>
      </Variable>
      <Variable x:TypeArguments="sco:Collection(x:String)" Name="CreateBy" />
      <Variable x:TypeArguments="x:String" Name="initiator" />
    </Sequence.Variables>
    <p1:WriteToHistory sap2010:WorkflowViewState.IdRef="WriteToHistory_1" Message="The GuitarWorkflow has started." />
    <p1:LookupSPListItem ItemGuid="{x:Null}" Properties="{x:Null}" sap2010:WorkflowViewState.IdRef="LookupSPListItem_1">
      <p1:LookupSPListItem.ItemId>
        <InArgument x:TypeArguments="x:Int32">
          <p:ExpressionContainerValue x:TypeArguments="x:Int32">
            <p1:GetCurrentItemId />
          </p:ExpressionContainerValue>
        </InArgument>
      </p1:LookupSPListItem.ItemId>
      <p1:LookupSPListItem.ListId>
        <InArgument x:TypeArguments="s:Guid">
          <mca:CSharpValue x:TypeArguments="s:Guid">System.Guid.Parse("{$ListId:Lists/Guitars;}")</mca:CSharpValue>
        </InArgument>
      </p1:LookupSPListItem.ListId>
      <p1:LookupSPListItem.Result>
        <OutArgument x:TypeArguments="p:DynamicValue">
          <mca:CSharpReference x:TypeArguments="p:DynamicValue">dv_0</mca:CSharpReference>
        </OutArgument>
      </p1:LookupSPListItem.Result>
    </p1:LookupSPListItem>
    <p:GetODataProperties DisplayName="GetDynamicValueProperties" sap2010:WorkflowViewState.IdRef="GetODataProperties_1">
      <p:GetODataProperties.Source>
        <InArgument x:TypeArguments="p:DynamicValue">
          <mca:CSharpValue x:TypeArguments="p:DynamicValue">dv_0</mca:CSharpValue>
        </InArgument>
      </p:GetODataProperties.Source>
      <scg:Dictionary x:TypeArguments="x:String, OutArgument">
        <OutArgument x:TypeArguments="x:String" x:Key="Guitar_x0020_Type">
          <mca:CSharpReference x:TypeArguments="x:String">GuitarType</mca:CSharpReference>
        </OutArgument>
        <OutArgument x:TypeArguments="sco:Collection(x:String)" x:Key="AuthorId">
          <mca:CSharpReference x:TypeArguments="sco:Collection(x:String)">CreateBy</mca:CSharpReference>
        </OutArgument>
      </scg:Dictionary>
    </p:GetODataProperties>
    <If sap2010:WorkflowViewState.IdRef="If_1">
      <If.Condition>
        <InArgument x:TypeArguments="x:Boolean">
          <mca:CSharpValue x:TypeArguments="x:Boolean">GuitarType.Equals("Acoustic")</mca:CSharpValue>
        </InArgument>
      </If.Condition>
      <If.Then>
        <p1:UpdateListItem ItemGuid="{x:Null}" ListItemProperties="{x:Null}" sap2010:WorkflowViewState.IdRef="UpdateListItem_1">
          <p1:UpdateListItem.ItemId>
            <InArgument x:TypeArguments="x:Int32">
              <p:ExpressionContainerValue x:TypeArguments="x:Int32">
                <p1:GetCurrentItemId />
              </p:ExpressionContainerValue>
            </InArgument>
          </p1:UpdateListItem.ItemId>
          <p1:UpdateListItem.ListId>
            <InArgument x:TypeArguments="s:Guid">
              <mca:CSharpValue x:TypeArguments="s:Guid">System.Guid.Parse("{$ListId:Lists/Guitars;}")</mca:CSharpValue>
            </InArgument>
          </p1:UpdateListItem.ListId>
          <p1:UpdateListItem.ListItemPropertiesDynamicValue>
            <InArgument x:TypeArguments="p:DynamicValue">
              <p:SetDynamicValueProperties>
                <scg:Dictionary x:TypeArguments="x:String, InArgument">
                  <InArgument x:TypeArguments="x:String" x:Key="Comment">VS Workflow added a comment: a new acoustic guitar item was added</InArgument>
                </scg:Dictionary>
              </p:SetDynamicValueProperties>
            </InArgument>
          </p1:UpdateListItem.ListItemPropertiesDynamicValue>
        </p1:UpdateListItem>
      </If.Then>
      <If.Else>
        <p1:UpdateListItem ItemGuid="{x:Null}" ListItemProperties="{x:Null}" sap2010:WorkflowViewState.IdRef="UpdateListItem_2">
          <p1:UpdateListItem.ItemId>
            <InArgument x:TypeArguments="x:Int32">
              <p:ExpressionContainerValue x:TypeArguments="x:Int32">
                <p1:GetCurrentItemId />
              </p:ExpressionContainerValue>
            </InArgument>
          </p1:UpdateListItem.ItemId>
          <p1:UpdateListItem.ListId>
            <InArgument x:TypeArguments="s:Guid">
              <mca:CSharpValue x:TypeArguments="s:Guid">System.Guid.Parse("{$ListId:Lists/Guitars;}")</mca:CSharpValue>
            </InArgument>
          </p1:UpdateListItem.ListId>
          <p1:UpdateListItem.ListItemPropertiesDynamicValue>
            <InArgument x:TypeArguments="p:DynamicValue">
              <p:SetDynamicValueProperties>
                <scg:Dictionary x:TypeArguments="x:String, InArgument">
                  <InArgument x:TypeArguments="x:String" x:Key="Comment">VS Workflow added a comment: a new electric guitar item was added</InArgument>
                </scg:Dictionary>
              </p:SetDynamicValueProperties>
            </InArgument>
          </p1:UpdateListItem.ListItemPropertiesDynamicValue>
        </p1:UpdateListItem>
      </If.Else>
    </If>
    <p1:LookupWorkflowContextProperty sap2010:WorkflowViewState.IdRef="LookupWorkflowContextProperty_1" PropertyName="InitiatorUserId">
      <p1:LookupWorkflowContextProperty.Result>
        <OutArgument x:TypeArguments="x:String">
          <mca:CSharpReference x:TypeArguments="x:String">initiator</mca:CSharpReference>
        </OutArgument>
      </p1:LookupWorkflowContextProperty.Result>
    </p1:LookupWorkflowContextProperty>
    <p:BuildCollection x:TypeArguments="x:String">
      <p:BuildCollection.Result>
        <OutArgument x:TypeArguments="sco:Collection(x:String)">
          <mca:CSharpReference x:TypeArguments="sco:Collection(x:String)">CreateBy</mca:CSharpReference>
        </OutArgument>
      </p:BuildCollection.Result>
      <p:BuildCollection.Values>
        <InArgument x:TypeArguments="x:String">
          <mca:CSharpValue x:TypeArguments="x:String">initiator</mca:CSharpValue>
        </InArgument>
      </p:BuildCollection.Values>
      <sap2010:WorkflowViewState.IdRef>BuildCollection`1_1</sap2010:WorkflowViewState.IdRef>
    </p:BuildCollection>
    <p1:Email AdditionalHeaders="{x:Null}" BCC="{x:Null}" CC="{x:Null}" sap2010:WorkflowViewState.IdRef="Email_1" Subject="New Guitar">
      <p1:Email.Body>
        <InArgument x:TypeArguments="x:String">
          <mca:CSharpValue x:TypeArguments="x:String">"A new guitar was added:" + GuitarType</mca:CSharpValue>
        </InArgument>
      </p1:Email.Body>
      <p1:Email.To>
        <InArgument x:TypeArguments="sco:Collection(x:String)">
          <mca:CSharpValue x:TypeArguments="sco:Collection(x:String)">CreateBy</mca:CSharpValue>
        </InArgument>
      </p1:Email.To>
    </p1:Email>
    <p1:WriteToHistory>
      <p1:WriteToHistory.Message>
        <InArgument x:TypeArguments="x:String">
          <mca:CSharpValue x:TypeArguments="x:String">String.Format("An email was sent by {0}.", initiator)</mca:CSharpValue>
        </InArgument>
      </p1:WriteToHistory.Message>
      <sap2010:WorkflowViewState.IdRef>WriteToHistory_3</sap2010:WorkflowViewState.IdRef>
    </p1:WriteToHistory>
    <p1:WriteToHistory sap2010:WorkflowViewState.IdRef="WriteToHistory_2" Message="Guitar Workflow has ended" />
    <sads:DebugSymbol.Symbol>d3FDOlxVc2Vyc1xkZXZ1c2VyXGRvY3VtZW50c1x2aXN1YWwgc3R1ZGlvIDIwMTJcUHJvamVjdHNcR3VpdGFyV29ya2Zsb3dcR3VpdGFyV29ya2Zsb3dcR3VpdGFyV29ya2Zsb3dcV29ya2Zsb3cueGFtbCktA74BDgIBATILMmcCAQI4BTh3AgFhOQVLGwIBVUwFWhwCAUVbBZMBCgIBLZQBBZoBKAIBJpsBBacBGQIBG6gBBbMBEAIBD7QBBbsBGQIBCbwBBbwBcQIBBzhTOHQCAWJDC0N0AgFcSAtIWwIBVzwLPigCAVZUC1RbAgFQTwtPUwIBS1cLV2kCAUZeC15nAgEuYgl4HQIBPHsJkQEdAgEzlwELlwFaAgEolAF2lAGHAQIBJ6MBC6MBUgIBIZ4BC54BaQIBHLABC7ABYQIBFqsBC6sBbwIBEagBe6gBhwECARC3AQu3AX4CAQq8AVO8AW4CAQg9DT0kAwFWAXEPdS0CAUNsD2x4AgE+ZQ9nLAIBPYoBD44BLQIBOoUBD4UBeAIBNX4PgAEsAgE0c0pziwECAURmEWYoAwE9AYwBSowBiwECATt/EX8oAwE0AQ==</sads:DebugSymbol.Symbol>
  </Sequence>
  <sap2010:WorkflowViewState.ViewStateManager>
    <sap2010:ViewStateManager>
      <sap2010:ViewStateData Id="WriteToHistory_1" sap:VirtualizedContainerService.HintSize="464,68" />
      <sap2010:ViewStateData Id="LookupSPListItem_1" sap:VirtualizedContainerService.HintSize="464,89">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <scg:Dictionary x:TypeArguments="x:String, msdad:ViewStateNameValue" x:Key="SPLocalizedDisplayNames">
              <msdad:ViewStateNameValue x:Key="ItemId" DisplayName="(current item)" Value="$CurrentItemId" />
              <msdad:ViewStateNameValue x:Key="ListId" DisplayName="Guitars" Value="Lists/Guitars" />
            </scg:Dictionary>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="GetODataProperties_1" sap:VirtualizedContainerService.HintSize="464,92">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:String x:Key="Properties.SelectedEntityType">Lists/Guitars</x:String>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="UpdateListItem_1" sap:VirtualizedContainerService.HintSize="200,68">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <scg:Dictionary x:TypeArguments="x:String, msdad:ViewStateNameValue" x:Key="SPLocalizedDisplayNames">
              <msdad:ViewStateNameValue x:Key="ItemId" DisplayName="(current item)" Value="$CurrentItemId" />
              <msdad:ViewStateNameValue x:Key="ListId" DisplayName="Guitars" Value="Lists/Guitars" />
            </scg:Dictionary>
            <x:String x:Key="ListItemPropertiesDynamicValue.SelectedEntityType">Lists/Guitars</x:String>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="UpdateListItem_2" sap:VirtualizedContainerService.HintSize="200,68">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <scg:Dictionary x:TypeArguments="x:String, msdad:ViewStateNameValue" x:Key="SPLocalizedDisplayNames">
              <msdad:ViewStateNameValue x:Key="ItemId" DisplayName="(current item)" Value="$CurrentItemId" />
              <msdad:ViewStateNameValue x:Key="ListId" DisplayName="Guitars" Value="Lists/Guitars" />
            </scg:Dictionary>
            <x:String x:Key="ListItemPropertiesDynamicValue.SelectedEntityType">Lists/Guitars</x:String>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="If_1" sap:VirtualizedContainerService.HintSize="464,218" />
      <sap2010:ViewStateData Id="LookupWorkflowContextProperty_1" sap:VirtualizedContainerService.HintSize="464,68">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <scg:Dictionary x:TypeArguments="x:String, msdad:ViewStateNameValue" x:Key="SPLocalizedDisplayNames">
              <msdad:ViewStateNameValue x:Key="PropertyName" DisplayName="Initiator" Value="InitiatorUserId" />
            </scg:Dictionary>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="BuildCollection`1_1" sap:VirtualizedContainerService.HintSize="464,22" />
      <sap2010:ViewStateData Id="Email_1" sap:VirtualizedContainerService.HintSize="464,68" />
      <sap2010:ViewStateData Id="WriteToHistory_3" sap:VirtualizedContainerService.HintSize="464,68" />
      <sap2010:ViewStateData Id="WriteToHistory_2" sap:VirtualizedContainerService.HintSize="464,68" />
      <sap2010:ViewStateData Id="Sequence_1" sap:VirtualizedContainerService.HintSize="486,1205">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="GuitarWorkflow.GuitarWorkflow.Workflow_1" sap:VirtualizedContainerService.HintSize="526,1285" />
    </sap2010:ViewStateManager>
  </sap2010:WorkflowViewState.ViewStateManager>
</Activity>

Not sure what I am doing wrong here. Any help is appreciated.

Edit. one other thing. I looked in the workflow manager database in sql express and only see info pertaining to WFs I created in SP Designer. I don't see this workflow. Not sure if I created the right kind of solution for deploying a VS workflow to Workflow Manager.

Foi útil?

Solução

The problem was the following line in the workflow xaml:

  <Variable x:TypeArguments="x:String" Name="GuitarType">
    <Variable.Default>
      <mca:CSharpValue x:TypeArguments="x:String">dv_0["Guitar Type"].ToString()</mca:CSharpValue>
    </Variable.Default>
  </Variable>

I was trying to apply a default value:

dv_0["Guitar Type"].ToString()

to a variable. I got the following error when deploying. I didn't see it in the original project:

Error occurred in deployment step 'Activate Features': Microsoft.Workflow.Client.ActivityValidationException: Workflow XAML failed validation due to the following errors:
The private implementation of activity '1: DynamicActivity' has the following validation error:   Cast operation is not supported for DynamicValue => Object.

When I removed the default value, the workflow deployed

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top