0

is it possible to change order of workflow autogenerated column (from last position to 2nd)? I need to do this programatically, not in Library > Modify view.

EDIT: Whole workflow I made in Visual Studio and it is with custom association, initiation an task form.

EDIT2: I figured it out, just reorder view in onWorkflowActivated method:

private void onWorkflowActivated_Invoked(object sender, ExternalDataEventArgs e)
    {
        string colName = workflowProperties.TemplateName;
        SPView defaultView = workflowProperties.List.DefaultView;
        if (defaultView.ViewFields.SchemaXml.Contains(colName))
        {       
            System.Collections.Specialized.StringCollection collStrings = defaultView.ViewFields.ToStringCollection();
            List<string> fields = new List<string>();
            foreach (string field in collStrings)
            {
                fields.Add(field);
            }

            if (fields.IndexOf(colName) != 2)
            {
                defaultView.ViewFields.MoveFieldTo(colName, 2);
                defaultView.Update();
            }
        }
    }
4

1 回答 1

0

您可以通过创建自定义工作流关联页面和代码来控制您的工作流如何与列表关联的逻辑。您应该查看此文档作为起点:http: //msdn.microsoft.com/en-us/library/ms481192.aspx

于 2012-05-22T14:47:20.297 回答