3

I'm trying to create a sequential workflow but it says it needs a history list.

How do I go about manually creating such a list. I don't see any in the site templates ?

1

Workflow History is automatically created in the site when a workflow is associated to a list (I think), but it is always hidden.

5

Workflow uses list of TemplateType 140 - WorkflowHistoryList.

When adding workflow from user interface, Sharepoint suggests you to create this list automatically.

If U want to add it programatically, U can use feature receiver with following code:


    public override void FeatureActivated(SPFeatureReceiverProperties properties)
    {
        var web = (SPWeb)properties.Feature.Parent;

        _uniqueId = web.Lists.Add("WorkflowLog", string.Empty, SPListTemplateType.WorkflowHistory);
        _list = web.Lists.GetList(_uniqueId, false);
        _list.Hidden = true;
        _list.Update();

        _uniqueId = web.Lists.Add("WorkflowTasks", string.Empty, SPListTemplateType.Tasks);
        _list = web.Lists.GetList(_uniqueId, false);
        _list.Hidden = true;
        _list.Update();
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.