gpt4 book ai didi

c# - 如何使用客户端对象模型关联 SharePoint 工作流?

转载 作者:行者123 更新时间:2023-11-30 18:06:16 25 4
gpt4 key购买 nike

使用 SharePoint 对象模型 (SP 2010),您如何将工作流与给定列表相关联?

我已经能够关联工作流,但配置设置没有保存回 SharePoint。换句话说,基本的WorkflowAssociationCreationInformation 将保存回 SharePoint,但不会保存使用 WorkflowAssociation 的任何进一步配置设置。

这是我一直在处理的代码:

var context = new ClientContext( url );
Web site = context.Web;

var query = context.LoadQuery( site.WorkflowTemplates.Where( x => x.Name == "My Template Name" ) );
context.ExecuteQuery();
WorkflowTemplate wfTemplate = query.Single();

var wfc = new WorkflowAssociationCreationInformation();
wfc.HistoryList = site.Lists.GetByTitle( "Workflow History" );
wfc.Name = "My Workflow Name";
wfc.TaskList = site.Lists.GetByTitle( "Tasks" );
wfc.Template = wfTemplate;

List list = site.Lists.GetByTitle( "List Name" );

WorkflowAssociation wf = list.WorkflowAssociations.Add( wfc );
wf.AllowManual = false; // is never updated
wf.AutoStartChange = false; // is never updated
wf.AutoStartCreate = true; // is never updated
wf.Enabled = true; // is never updated
string assocData = GetAssociationXml(); // internal method
wf.AssociationData = assocData; // is never updated

context.Load( wf );
context.ExecuteQuery(); // does not update the SP workflow with any of the new wf settings

最佳答案

list.WorkflowAssociations.Update(wf) 设置您的配置项后,将更新您的 WorkflowAssociation 上的配置项。

关于c# - 如何使用客户端对象模型关联 SharePoint 工作流?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5007715/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com