工作流模板为此页面指定了没有FormURN在关联开箱即用的SharePoint 2010发布审批工作流时出错

时间:2014-02-10 13:38:51

标签: visual-studio-2012 sharepoint-2010 sharepoint-2013 sharepoint-designer sharepoint-workflow

您好我已经使用Visual Studio中的导入Sharepoint 2010工作流项目将从Sharepoint Designer 2013导入的现成SharePoint 2010发布审批工作流与Visual Studio 2012相关联。 我还将工作流程与C#相关联,如下所示:

 public void AddWorkflowAssociationToPagesList(SPList assoicationList, string spWorkflowTemplateGuid)
        {

            try
            {

                SPWorkflowTemplate workflowTemplate =
                    _web.WorkflowTemplates.GetTemplateByBaseID(new Guid(spWorkflowTemplateGuid));

                if (workflowTemplate == null) { _logger.LogError(LoggingCategory.Workflow, "Error in associating workflow with guid: " + spWorkflowTemplateGuid + " The workflowtemplate does not exist in: " + _web.MasterUrl); }

                SPList pagesList = _web.Lists[PublishingWeb.GetPagesListName(_web)];

                if (workflowTemplate != null)
                {
                    var taskList = _listProvisioner.TryGetList(_web, _localaizedWorkFlowTaskList, string.Empty, true, SPListTemplateType.Tasks);
                    var historyList = _listProvisioner.TryGetList(_web, _localaizedWorkFlowHistoryList, string.Empty, true, SPListTemplateType.WorkflowHistory);

                    SPWorkflowAssociation workflowAssocaition = SPWorkflowAssociation.CreateListAssociation(workflowTemplate,_workflowAssociationName, taskList, historyList);
                    assoicationList.WorkflowAssociations.Add(workflowAssocaition);

                    _web.AllowUnsafeUpdates = true;
                    assoicationList.DefaultContentApprovalWorkflowId = workflowAssocaition.Id;
                    assoicationList.Update();
                    _web.AllowUnsafeUpdates = false;
                }
            }
             catch (Exception ex)
            {
                _logger.LogError(LoggingCategory.Workflow, "Error: " + ex + " in associating workflow with id: " + spWorkflowTemplateGuid);                
            }   
        }

当我尝试在页面库中发布页面时发生错误: 工作流模板未为此页面指定FormURN

ULS日志在关联ID上给出了这个:

Application error when access /_layouts/15/IniWrkflIP.aspx, Error=The workflow template has specified no FormURN for this page.  
 at Microsoft.Office.Workflow.IniWrkflIPPage.LoadFromWorkflowAssociation()    
 at Microsoft.Office.Workflow.IniWrkflIPPage.OnLoad(EventArgs ea)    
 at System.Web.UI.Control.LoadRecursive() 
 at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean    includeStagesAfterAsyncPoint)

如果我在创建库中的新项目时更改工作流程的开始条件,只有在通过发布页面启动工作流程时才会发生这种情况。

以前有没有人遇到过这种问题?

问候。

1 个答案:

答案 0 :(得分:0)

您是否尝试从页面本身的功能区发布它?不幸的是,该部分完全依赖于作为InfoPath表单的起始表单而不是ASP.Net表单。然而,如果您尝试通过checkin / major发布它或通过Pages库上下文菜单发布主要版本,您会发现它将正常工作。如果您从两个方面获得相同的行为,或者仅仅是在页面本身的功能区中的按钮上,请告诉我。