.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Workflow variables of type IList (using WF4)

Posted By:      Posted Date: October 07, 2010    Points: 0   Category :Windows Application


I am having problems creating a variable of type IList<MyCustomType>. The workflows themselves are in one (Workflows) assembly and the custom types are in a different assembly (BusinessObjects). Workflows references BusinessObjects and everything seems fine in the designer.

When I try to run the workflow I get a SourceExpressionException - 'Compiler error(s) encountered processing expression "myVariable". Type 'MyCustomType' is not defined.

This exception comes from Microsoft.VisualBasic.Activities.VisualBasicHelper.Compile.

It appears that the runtime is not able to find this type, but I am not sure why. The BusinessObjects assembly is available in the directory that the executable is running in.

Has anyone got any examples of creating and passing variables using generics where the type parameter is a custom type?



View Complete Post

More Related Resource Links

Any good Approval-type workflow tutorials for VS 2010?

Greetings.  I'm looking for some good tutorials (or books) on creating SharePoint 2010 Approval workflows in Visual Studio 2010.  I've spent a few hours digging through the search results on bing/google, but almost all of the examples (including content from Microsoft) show a very simple workflow in Visual Studio 2010 that doesn't contain approval steps.  I am looking for a more comprehensive tutorial on how to build a workflow that contains approval steps and evaluates the column values (i.e. evaluate a list column  if(Total Cost > 10000)) to determine branching.  InfoPath integration is a bonus but not required.  Anyone have any good links with solid tutorials?  Thanks in advance.

Create Content Type in State Machine Workflow

Hi, I created a state machine workflow in share point 2007 with default associated task list. This is working fine. Now I want to add a custom content type to task in which I want to show 3 fields on task form : Title, Description, status And also I want to set some default values in these fields. How can I create and add this custom content type in state machine workflow ? G. Goyal

Cannot Implicitly Convert Type Ilist to List

Hi All, In the below code i get the Following Error, Cannot implicitly convert type 'System.Collections.Generic.List<Nous.nSpeckEnterprise.GetEnterpriseComponent_Result>' to 'System.Collections.Generic.IList<Nous.nSpeckEnterprise.Component>'. An explicit conversion exists (are you missing a cast?)   <br/> NSTTT_CRRISQ_TESTEntities entities = new NSTTT_CRRISQ_TESTEntities();<br/> IList<Component> Components = new List<Component>();<br/> var c = entities.GetEnterpriseComponent(componentId).ToList();<br/> <strong>Components = c;<br/> </strong> return Components;   Can anyone help me how to do teh cast.......Thanks  

Creating a workflow condition based on document type

Hello! I'm creating a workflow for a Document Library. I only want the action in the workflow to be executed on the condition that the document is of a certain document type. Any suggestions how I should do that? Thanks!

Activating an approval workflow on adding a new content type


How can I associate a workflow with the content types list? My scenario is that I allow users to add newcustom content types but they are needed to be first approved before they get added to the list of site content types. I couldn't find a way to associate a workflow with the site content types in Site Settings -> Site Content Types.

System.ArgumentException : The input workflow type must be an Activity.


Hi everyone! I’m getting this error when starting up the workflow:

System.ArgumentException : The input workflow type must be an Activity.
Parameter name: workflowType

The code I’m using is shown below:

using (var wf = new WorkflowRuntime())
  wf.WorkflowCompleted += (_, __) => signal.Set();
  wf.WorkflowTerminated += (_, __) => signal.Set();
  var args = new Dictionary<stringobject>();
  args.Add("Input", plainText);
  var inst = wf.CreateWorkflow(typeof (HtmlTypography), args

Unable to attach a custom SharePoint Workflow to a Content Type


I am working with SharePoint Server 2010 Beta 2, Visual Studio 2010 Ultimate RC and SharePoint Designer 2010 Beta.

I built a custom Content Type based on the Item type with a few custom site columns. I also have built a custom Sequential Workflow using Visual Studio 2010. This is a relatively simple workflow that creates a task, waits for the task to complete, sets the workflow to complete. I am able to deploy this workflow to the site collection through VS 2010.

The problem I have is that when I try to associate my custom Content Type with my custom workflow, that workflow is not listed in the workflow templates to select. There are only the OOTB SharePoint workflows to choose. However, if I create a list and associate a workflow to that list, my custom workflow is listed in the workflow template list.

This makes sense since at the start of building a custom workflow in VS2010, one of the first questions is whether the workflow is a Site or a List workflow and I selected List.

I did a little research and found some who wrote that Reusable Workflows may be attached to Content Types.  In VS2010, there is no option to build a Reusable Workflow.  That is only possible in SharePoint Designer.  However, it is possible to import a SPD workflow into VS, so I tried that.  Imported the WSP into VS201

Custom Workflow TaskEditForm(Custom Content Type) not getting displayed in Tasks List.



I have developed a custom sequential workflow. I have also developed a custom content type derived from Workflow Task Content Type.

I have 1 TaskEditForm.aspx in this custom Content Type. The custom Content Type is getting associated with the Tasks List but when I click EditItem option in ECB Menu or Ribbon,the in-built EditForm.aspx gets displayed instead of displaying my custom TaskEditForm.aspx from the custom Content Type.

Can anybody help?


Regards,Gautam Kaikini, SharePoint Developer. http://in.linkedin.com/in/gautamkaikini

Problem while creating task with custom content type in sharepoint workflow


Hi all,

I am trying to create task with custom content type in sharepoint statemachine workflow. But it is showing "Error Occured" after task creation code is excecuted. can anyone tell me what is the problem.

Task Content type


  <ContentType  ID="0x01080100A707C0079E8547c0A87515457DB90629"
      Description="Workflow Task"
      <FieldRef ID="{9da97a8a-1da5-4a77-98d3-4bc10456e700}" Name="MyComments" DisplayName="MyComments"  />
      <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
        <FormUrls xmlns="

Passing parameters of type List<> from a web application to the Receive activity of a workflow servi



I have a Recieve activity with the following parameters in the Content property.  Using generic parameter names here:

- parameter1 of type Object1 assigned to Parameter1 variable

- parameter2 of type List<Object2> assigned to Parameter2 variable.  Note - default value of Parameter2 variable = New List(Of Object2)()

- parameter3 of type Object3 assigned to Parameter3 variable

In my web application, I create a service reference and create a client as such:


SomeWFServiceClient client = null


 client = new
 List<Object2> listOfObject2 = new
 List<Object2> { new
 Object2 {Id=1, Name="SomeName"
, Type="Customer"
 }, };

client.ProcessSomething(Object1, listOfObject2, Object3);


I have a breakpoint at the Receive activity.  When I look at the values that get assigned to the Receive activity parameters, I see that parameter1 and parameter3 ge

how to create a custom task content type for VS2008 workflow



i want to create a WorkFlow by VS2008 and i want to use custom content type for the tasks, and i want to build this cutome content type by Aspx form but i don't know how, any ideas ??


Thanks for all.

Workflow Constructor Error: Could not create activity of type '{Workflow}'

If I attempt to new-up a custom class in my Workflow constructor:

_workflowInfo =  
                new WorkflowInfo(workflowProperties.OriginatorUser, workflowProperties.Item,  

... I receive the following error:

Error 1 Could not create activity of type '{Workflow}'. System.ArgumentNullException: Value cannot be null.
Parameter name: uriString
   at System.Uri..ctor(String uriString)
   at Microsoft.Shar

foreach statement cannot operate on variables of type 'object' because 'object' does not contain



Still struggling with this code Frown


I'm trying to follow an example in a book i'm reading, but the example is using linq to sql, i'm trying to use linq to xml. Problem is i get the following error:

Error 1 foreach statement cannot operate on variables of type 'object' because 'object' does not contain a public definition for 'GetEnumerator' d:\MVC3_Website\Website.WebUI\Views\Home\Index.aspx 11 8 Website.WebUI


My code is:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Website.Domain.Models.Weather.Entities
    public class WeatherForcast
        public string loc { get; set; }
        public string loc_id { get; set; }

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml.Linq;
using Website.Domain.Models.Weather.Abstract;
using Website.Domain.Models.Weather.Entities;

namespace Website.Domain.Models.Weather.Concrete
    public class WeatherRepository : IWeatherRepository
        public IEnumerable<WeatherForcast> GetWeatherCity(string strWeatherCity)

The workflow associated with the document content type won't be seen wss 3.0


Hello! I want to use a custom workflow,associated with the  document content type. But In the  doc library when I click on the document-item wich belongs to that content type, the  workflow associated with that content type won't appear. Maybe I missed something.

Any suggestion link, sample   would be appreciated.


Variable types are strict, except for variables of type Object- SSIS 2008


Hi , I declared a user variable MINIODate  as string in package level and assigned this variable in an execute sql task 2008 , where my source is ado.net and sql command is Select CSTR(MIN(IODate) ) as MINIODate  from IOData ( This is source table available in MSAccess DB) , The above senario working fine in 2005. During the run time in 2008  i am getting the following error

[Execute SQL Task] Error: An error occurred while assigning a value to variable "MINIODate": "The type of the value being assigned to variable "User::MINIODate" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object.

SharePoint Designer 2010 workflow specified in Content Type retention policy not starting



I have a SharePoint Designer 2010 resuable workflow that uses the "Start Approval Process" Task Action. This workflow needs to run after a document has been declared a record. So I have a Content Type that has an Information Management Policy (IMP) attached to it. And I have 2 retention stages specified in the IMP. The first retention stage action is to run the workflow. And this Content Type is associated with the Document Library containing the records. But for some reason, the SPD workflow never gets triggered. The document has been successfully declared as a record. I also see in the document's "Compliance Details" screen, the "Scheduled Occurrence Date" is set to the proper date, but the workflow never got started on that date. I tried it with different dates that I set in the document, to ensure that the workflow runs on "Scheduled Occurence" dates such as 11/19/2010, 11/20/2010 to no avail.

What am I missing? Any help/suggestions would be greatly appreciated as always.

Best regards,
Kiran K

Workflow for External Content Type (Associated List) Gives Error


Hello Community.

Background: I have created an external content type, and then an external list from the content type.  Next I created a custom list with the same metadata fields as the external list.  All this works as it should with no issues.  Finally  created a simple 1 step workflow that is designed to update the external list with the data provided in the custom list. 

Problem: When I run the workflow I get the error below:

The workflow could not update the item in the external data source. Make sure the user has permissions to access the external data source and update items. Unknown error
 12/3/2010 8:39 AM Error  System Account

Has anyone seen this before and if so how did you resolve it?



Tom Molskow - SharePoint Architect - Linked-In - SharePoint Gypsy
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend