1

我一直在使用 info path 2013 将一堆 infopath 表单(许多在 infopath 2003 中创建)移动到 SharePoint。

多年来我们一直在做表格的方式之一是允许用户保存他们填写表格的进度。在 infopath 中,我们通过检查验证错误来解决这个问题,如果为什么在 xml 中设置一个指示表单不完整的节点,保存并清除错误,调用保存 web 服务,然后通过只需将具有验证错误的每个节点的值设置为其已有的值。

示例:检查错误:

XPathNavigator node =      MainDataSource.CreateNavigator().SelectSingleNode("//my:reportIsValid", NamespaceManager);
if (Errors.Count == 0)
            node.SetValue("1");
        else
            node.SetValue("0");

保存并清除错误:

System.Collections.Generic.List<FormError> SaveErrors = new System.Collections.Generic.List<FormError>();
SaveErrors.AddRange(Errors.GetErrors(FormErrorType.SchemaValidation));
SaveErrors.AddRange(Errors.GetErrors(FormErrorType.SystemGenerated));
SaveErrors.AddRange(Errors.GetErrors(FormErrorType.UserDefined));


Errors.DeleteAll();

恢复错误:

foreach (FormError er in SaveErrors)
   {
     string tempval = er.Site.Value;
     er.Site.SetValue(tempval);
   }

虽然这在 infopath 中对我们来说没有问题,但它在 sharepoint 中仅在某些形式上失败,我还没有弄清楚为什么,或者如何解决它。

在 sharepoint 中,当我们尝试设置值时,restore 方法有时会返回异常。

有没有人知道为什么这会在 infopath 中 100% 的时间有效,但在 sharepoint 中只有约 80% 的时间有效?

还有其他方法可以恢复验证吗?

4

0 回答 0