Error Scenario – Workflow History list not found!

In this article we can explore a common scenario associated with creating Workflows in Visual Studio 2010.

Scenario

You are creating a workflow through Visual Studio 2010. The SharePoint 2010 templates are installed and while selecting Workflow template and entering site url you receive the following error:

The SharePoint site at URL is missing a target, task, or history list. Each of these lists is required to associate a workflow template. Please create a list and then launch this wizard.

clip_image001[5]

Root Cause

Workflow requires the following lists for its working:

· Workflow History of Template 140

· Workflow Tasks of Template 107

Solution

There are many solutions to the above problem like:

1. Create a new site from a site template that includes Workflow History & Task list

2. Create the 2 lists Programmatically

3. Create the 2 lists using PowerShell

Here I would apply the second solution, using C# code to create the 2 lists.

 

Implementation

Create a new SharePoint Console Application and change the project properties as:

· Target Framework to 3.5

Add the following code to the Main() method. Please change your url accordingly.

class Program

{

private static string URL = “http://yourblanksite”;

static void Main(string[] args)

{

using (SPSite site = new SPSite(URL))

{

using (SPWeb web = site.OpenWeb())

{

web.Lists.Add(“Workflow History”, string.Empty, SPListTemplateType.WorkflowHistory);

web.Lists.Add(“Workflow Task”, string.Empty, SPListTemplateType.Tasks);

}

}

}

}

Execute the above code and if it completed without errors, your problem is solved. Try creating the workflow again and you should not see the error.

Verification

Inside SharePoint you can verify our new lists as shown below.

clip_image003[6]

Template Enumeration Reference

You can refer the Template Enumeration (SPListTemplateType) here.

Name Description
InvalidType Not used. Value = -1.
NoListTemplate unspecified list type. Value = 0
GenericList Custom list. Value = 100.
DocumentLibrary Document library. Value = 101.
Survey Survey. Value = 102.
Links Links. Value = 103.
Announcements Announcements. Value = 104.
Contacts Contacts. Value = 105.
Events Calendar. Value = 106.
Tasks Tasks. Value = 107.
DiscussionBoard Discussion board. Value = 108.
PictureLibrary Picture library. Value = 109.
DataSources Data sources for a site. Value = 110.
WebTemplateCatalog Site template gallery. Value = 111.
UserInformation User Information. Value = 112.
WebPartCatalog Web Part gallery. Value = 113.
ListTemplateCatalog List Template gallery. Value = 114.
XMLForm XML Form library. Value = 115.
MasterPageCatalog Master Page gallery. Value = 116.
NoCodeWorkflows No Code Workflows. Value = 117.
WorkflowProcess Custom Workflow Process. Value = 118.
WebPageLibrary Wiki Page Library. Value = 119.
CustomGrid Custom grid for a list. Value = 120.
SolutionCatalog Solutions. Value = 121
NoCodePublic No Code Public Workflow. Value = 122
ThemeCatalog Themes. Value = 123
DataConnectionLibrary Data connection library for sharing information about external data connections. Value = 130.
WorkflowHistory Workflow History. Value = 140.
GanttTasks Project Tasks. Value = 150.
Meetings Meeting Series (Meeting). Value = 200.
Agenda Agenda (Meeting). Value = 201.
MeetingUser Attendees (Meeting). Value = 202.
Decision Decisions (Meeting). Value = 204.
MeetingObjective Objectives (Meeting). Value = 207.
TextBox Text Box (Meeting). Value = 210.
ThingsToBring Things To Bring (Meeting). Value = 211.
HomePageLibrary Workspace Pages (Meeting). Value = 212.
Posts Posts (Blog). Value = 301.
Comments Comments (Blog). Value = 302.
Categories Categories (Blog). Value = 303.
Facility Facility. Value = 402
Whereabouts Whereabouts. Value = 403
CallTrack Call Track. Value = 404
Circulation Circulation. Value = 405
Timecard Timecard. Value = 420
Holidays Holidays. Value = 421
IMEDic IME (Input Method Editor) Dictionary. Value = 499
ExternalList External. Value = 600
IssueTracking Issue tracking. Value = 1100.
AdminTasks Administrator Tasks. Value = 1200.
HealthRules Health Rules. Value = 1220
HealthReports Health Reports. Value = 1221

The link is added in the References section too.

References

http://tinyurl.com/sp2010-lsttmpref

Summary

In this article we have explored a common error scenario associated with workflow creation and a solution for it.

4 thoughts on “Error Scenario – Workflow History list not found!

  1. Ankit says:

    Hi Jean,
    I have read your article but did not get the use of impersonation yet.can u explain this in a real example of SharePoint ?

    1 more question..Suppose i have a list called “Customer” in site A and if i want to access this list in Site “B” for which user dont have any access to list “Customer”..can we use impersonation in this scenario.If so then please let me know how can we do this .

    Regards.,
    Ankit Tayal

    1. Jean Paul says:

      Hello Ankit,

      Thanks for the update..

      I wanted to give you a scenario that could give more information regarding this.

      Manager & Employee are 2 users, Manager have all lists permissions including the Holidays list.
      Employee do not have permission to the holiday list.

      Employee trying to apply for leave through a web part, the web part lookup the date in Holidays list and throws error.
      The error occurs as the code is being executed in Employee context.

      In order to run the above web part smoothly, the code has to be in elevated privileges. The Impersonation code performs the same.
      Hope this makes it better. I prefer you create the scenario yourself and feel the difference.

      Regards,
      Jean Paul

  2. Shreyas says:

    Hi Jean,

    I was trying ti implement Foster Application and came across this error.
    Will this error occur when you create a blank site in Sharepoint server?

    Also I am trying to resolve this error as per your above suggestion but Console Application option not available in VS2010… What should I do?

  3. JP says:

    Try using windows forms (Any CPU option)

Leave a Reply

Your email address will not be published. Required fields are marked *