System.Runtime.InteropServices.COMException:'[24] KdoLib:未知错误。

时间:2019-04-29 06:49:05

标签: kofax

我为自定义模块创建了一个安装表单。启动管理模块时,我可以使用batchClass.get_CustomStorageString("key");(通过键获取值)和batchClass.set_CustomStorageString("key", "value");(通过键设置值)为自定义模块运行时设置一些设置。在管理模块中时,我可以在多次启动时访问存储数据,因此一切都很好。

在运行时运行batchmanager时,自定义模块尝试使用相同的键访问数据并引发此错误

  

System.Runtime.InteropServices.COMException:'[24] KdoLib:未知   错误。

错误消息本身不提供任何错误信息。设置表单处理批处理类型IBatchClass,运行时处理处理类型IBatch。因此,运行时使用batch.get_CustomStorageString("key");。这种访问数据的方式不正确吗?

1 个答案:

答案 0 :(得分:1)

看来我自己解决了。在运行期间,我必须提取设置数据。这将返回批处理类,而这些将返回当前的批处理类。批处理类本身包含要访问的自定义存储字符串。

代码应该是

    private const string BATCH_CLASSES = "BatchClasses";
    private const string BATCH_CLASS = "BatchClass";
    private const string BATCH_CLASS_CUSTOM_STORAGE_STRINGS = "BatchClassCustomStorageStrings";
    private const string BATCH_CLASS_CUSTOM_STORAGE_STRING = "BatchClassCustomStorageString";

    public void ProcessBatch(IBatch batch)
    {
        IACDataElement setupElement = batch.ExtractSetupACDataElement(0);
        IACDataElementCollection batchClasses = setupElement.FindChildElementByName(BATCH_CLASSES).FindChildElementsByName(BATCH_CLASS);
        IACDataElement batchClass = batchClasses[1]; // Kofax starts at 1 // always take the first item because there is only one?
        IACDataElement customStorageStrings = batchClass.FindChildElementByName(BATCH_CLASS_CUSTOM_STORAGE_STRINGS);

        IACDataElement customStorageItem = customStorageStrings.FindChildElementByAttribute(BATCH_CLASS_CUSTOM_STORAGE_STRING, "Name", "-- myKey --");
        string customStorageItemValue = customStorageItem["Value"];
    }

我在以下位置找到了示例代码

  

... \ CaptureSV \ Source \ Sample Projects \ Workflow \ WFSample