Infopath: Iterating through a repeating table that is bound to a Sharepoint-List

12 11 2008 Software-Development
this is how you do it with Infopath 2007 and Microsoft Office Server 2007 (MOSS2007) or Windows Sharepoint Server 3.0. It's not valid for Infopath 2003. I've added comments to the code, so if you are a little familiar with c# it should be quite self explanatory. If you have questions just ask.

public void test1()
      {
          //We're creating a XpathNodeIterator here. Each Node in the XpathNavigator-Collection nodes1 represents one row of the sharepoint list
          XPathNodeIterator nodes1 = DataSources["string-name of the sharepointlist-data-connection";, NamespaceManager);         


          foreach (XPathNavigator n in nodes1)       
	  {   	// The field/column of each single row of the list you want is represented as an attribute
    	  MessageBox.Show(n.GetAttribute("field-/column-name", nodes1.Current.NamespaceURI));
	  }

Replace the Messagebox.Show with any action that you need to.

cronjob