ErrorObject interface

Represents an error in a Microsoft InfoPath form.

Namespace:  Microsoft.Office.Interop.InfoPath
Assembly:  Microsoft.Office.Interop.InfoPath (in Microsoft.Office.Interop.InfoPath.dll)

public interface ErrorObject : Error

This type is a wrapper for a coclass that is required by managed code for COM interoperability. Use this type to access the members of the COM interface implemented by this coclass. For information about the COM interface, including a link to descriptions of its members, seeError.

Each Error object in InfoPath is each associated with an XML Document Object Model (DOM) node from a form's underlying XML document. When data validation fails for a particular XML DOM node, InfoPath creates an Error object and places it in the ErrorsCollection collection.

There are three types of data validation errors that can occur in an InfoPath form:

  • SCHEMA_VALIDATION Data validation failed as a result of an XML Schema–defined constraint.

  • SYSTEM_GENERATED Data validation failed as a result of constraints defined in the form definition (.xsf) file or as a result of form code calling the ReportError method of DataDOMEventObject object.

  • USER_SPECIFIED Data validation failed as a result of a custom scripting error using the Add method of the Errors collection.


The ErrorType property can be used to determine the type of data validation error that has occurred.

In the following example, the Error object is accessed using indexing in the Errors collection.

Error er = thisXDocument.Errors[0];