简体   繁体   English

Sharepoint 2010自动生成的工作流程列

[英]Sharepoint 2010 autogenerated workflow column

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. 编辑:我在Visual Studio中进行的整个工作流程,它是与自定义关联,启动任务表。

EDIT2: I figured it out, just reorder view in onWorkflowActivated method: EDIT2:我想通了,只是在onWorkflowActivated方法中重新排序视图:

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();
            }
        }
    }

You can control the logic of how your workflow is associated to the list by creating a custom workflow association page and code behind. 您可以通过创建自定义工作流程关联页面和后面的代码来控制工作流程如何与列表关联的逻辑。 You should look into this documentation as a starting point: http://msdn.microsoft.com/en-us/library/ms481192.aspx 您应该以此文档为起点进行研究: http : //msdn.microsoft.com/zh-cn/library/ms481192.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM