Question

I'm trying to attach a standard Approval Workflow 2010 to a document library however the powershell script I am using is throwing an exception in the following spot:

# Create Workflow History list if it does not already exist
if($HistoryList -eq $null)
{
    $Web.Lists.Add("Workflow History", "Workflow History","Lists/Workflow History", "00BFEA71-4EA5-48D4-A4AD-305DE7030140", 140, "101");
    $HistoryList = $Web.Lists["Workflow History"];
}

The error tells me:

"Feature '00bfea71-4ea5-48d4-a4ad-305de7030140' for list template '140' is not installed in this farm."

The GUID refers to the WorkflowHistoryList feature but when I try to enable the feature on the subsite I am interested in I receive another error as

"The Feature is not a Farm Level Feature and is not found in a Site Level defined by the Url...."

What is confusing me even further is that if I simply manually create an approval workflow on a document library Then run my powershell script to associate an approval workflow, it works without any issue - it's as if creating a workflow for the first time somehow enables the feature at the web level I am interested in.

Has anyone else experienced similar?

Was it helpful?

Solution

When doing Web.Lists.Add there is a method overload which takes only a list template. By getting the WorkflowHistory list template you can avoid having to lookup the relevant feature.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top