我从编程工作流中学习了以下内容,并使用SPD进行了部署。
1.不要依赖在工作流程标注中传递所需的所有字段:定义看似合理的内容,但请记住,一旦您访问了SPList项目,就可以从内部绕过对象模型您的工作流程无需重复更改界面并重新部署。
即一旦你已经在你的.actions文件中定义的这三样东西,并将其传递给您的工作流程
public static DependencyProperty __ContextProperty = DependencyProperty.Register("__Context", typeof(WorkflowContext), typeof(YourWorkflowClass));
public static DependencyProperty __ListIdProperty = DependencyProperty.Register("__ListId", typeof(string), typeof(YourWorkflowClass));
public static DependencyProperty __ListItemProperty = DependencyProperty.Register("__ListItem", typeof(int), typeof(YourWorkflowClass));
你设置访问任何你可能已经忘记了部署时明确地传递。
2.使用上下文直接创建您想要的SharePoint项目的实例时注销,因为您可能会不知不觉地传递调用该工作流程的人的权限。即为此
SPWeb tmpweb = __Context.Web;
SPSite site = new SPSite(tmpweb.Url);
SPWeb web = site.OpenWeb();
,而不是这样的:
SPWeb web = __Context.Web;
3.Debugging是难以成立,如果你不碰巧有安装在同一台机器包括SharePoint视觉工作室。