我从编程工作流程和使用 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. 直接使用上下文创建您想要的共享点项目的实例时要小心,因为您可能会在不知不觉中传递调用工作流的人的权限。即这样做
SPWeb tmpweb = __Context.Web;
SPSite site = new SPSite(tmpweb.Url);
SPWeb web = site.OpenWeb();
而不是这个:
SPWeb web = __Context.Web;
3.如果您没有将Visual Studio安装在与SharePoint相同的盒子上,则很难设置调试。