« Google Apps: Enable a group to be able to write e-mails with the group addressUbuntu 8.04.4 LTS + mysqlhotcopy = "...at line 1 at /usr/bin/mysqlhotcopy line 473" »

InfoPath, Repeating Table and System.InvalidOperationException

28.09.11

Permalink 20:48:40, von ff E-Mail , 244 Wörter   German (DE) latin1
Kategorien: Computer, Microsoft

InfoPath, Repeating Table and System.InvalidOperationException

Today I had hours of fun with InfoPath: What I was trying to do was basically fill some repeating groups with SharePoint list data by querying it programmatically with CAML. The problem was the "some": One group would work and some other ones would throw an exception like this one:

System.InvalidOperationException wurde nicht von Benutzercode behandelt.
Message="Nicht datentypbezogene Fehler bei der Schemaüberprüfung."
Source="Microsoft.Office.InfoPath.Client.Internal.Host.Interop"
StackTrace:
at Microsoft.MsoOffice.InfoPath.MsxmlInterop.MsxmlDocument.ThrowExceptionFromMsxmlInteropError(MsxmlInteropError eError)
at Microsoft.MsoOffice.InfoPath.MsxmlInterop.MsxmlDocument.ThrowExceptionFromHresult(Int32 hrError)
at Microsoft.MsoOffice.InfoPath.MsxmlInterop.MsxmlNodeImpl.AppendChild(String strXml)
at Microsoft.Office.InfoPath.MsxmlWriter.Close()
at System.Xml.XmlWellFormedWriter.Close()
at XYZ.FormCode.LoadAffectedProductsChoice()
at XYZ.FormCode.FormEvents_Loading(Object sender, LoadingEventArgs e)
at Microsoft.Office.InfoPath.Internal.FormEventsHost.OnLoad(DocReturnEvent pEvent)
at Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_SinkHelper.OnLoad(DocReturnEvent pEvent)

The code causing the problem looked like:

String myNamespace = NamespaceManager.LookupNamespace("my");
XPathNavigator node = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:RelatedCrsChoiceGroup", this.NamespaceManager);

using (XmlWriter writer = node.AppendChild())
{
writer.WriteStartElement("RelatedCrsChoice", myNamespace);
writer.WriteElementString("relatedCrId", myNamespace, "abc");
writer.WriteElementString("relatedCrTitle", myNamespace, "def");
writer.WriteEndElement();
writer.Close();
}

The issue was that I set up the repeating groups within one group. The last defined repeating group in the data connections would not throw the error, all others do.

The solution was as simple as to give every single repeating group a dedicated top group - and all errors were gone.

Noch kein Feedback

Einen Kommentar hinterlassen


Ihre E-Mail-Adresse wird nicht auf dieser Seite angezeigt.

Ihr URL wird angezeigt.
(Zeilenumbrüche werden zu <br />)
(Name, E-Mail-Adresse & Webseite)
(Benutzern erlauben, Sie durch ein Kontaktformular zu kontaktieren (Ihre E-Mail-Adresse wird nicht weitergegeben))
Mai 2012
Mo Di Mi Do Fr Sa So
 << <   > >>
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

Suche

powered by b2evolution