Hello Maggie,
Sorry for the late reply. Here is a brief explanation of the code.
SharepointListAdapter oSpla =
(SharepointListAdapter)thisXDocument.DataAdapters["SharePoint Adapter"];
string sUrl = oSpla.SiteUrl;
This code is used to get the URL from where you want to get the data.
IXMLDOMDocument2 oDom =
(IXMLDOMDocument2)thisXDocument.GetDOM("SharePoint Adapter ");
oDom.setProperty("SelectionNamespaces",
"xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolut
ion\"");
string sTitle =
oDom.selectSingleNode(string.Format("//dfs:SharePointAdapter[@Title=\"{0}\"]
/@Title", sStandardTitle)).text;
string sFilename = sUrl + sSP_HEADTRAX_FOLDER + sTitle;
This code is used to get the DOM for this data connection and then get the sTitle (that is the filename of one of the files in that form library) based on one of the node values being equal to "sStandardTitle" and it gets the full path to this xml file.
IXMLDOMDocument2 oXml =
(IXMLDOMDocument2)thisXDocument.CreateDOM();
oXml.async = false;
oXml.load(sFilename);
oXml.setProperty("SelectionNamespaces",
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns:rd=\"http://www.microsoft.com/WorldwideSalesOperations/Roles/Definitio
ns/2004/Role\" xmlns:xhtml=\"http://www.w3.org/1999/xhtml\"
xmlns:my=\"http://schemas.microsoft.com/office/infopath/2003/myXSD/2004-02-0
4T17:30:19\"
xmlns:xd=\"http://schemas.microsoft.com/office/infopath/2003\"");
This code creates a DOM called oXml and loads the data in the file whole full path we got above.
IXMLDOMNode oNewNode =
oXml.selectSingleNode("//rd:Roles/rd:Role//" + oExistingNode.nodeName);
oParentNode.replaceChild(oNewNode.cloneNode(true),
oExistingNode);
This code then gets the data in that file and then replaces data in the Main DOM with this data. There is most probably a dropdown list box which gets data from these nodes.
If you just want to populate a dropdown list box with data from a Sharepoint list (like its file name or any other promoted properties) then you can do this
1. Create a data connection to the Sharepoint form library
2. Insert a dropdown list box in the view and go to its properties window and choose the third radio button to get data from a data connection. Choose the appropriate data connection and the value that you want to show in the dropdown.
Hope this helps!
Shanthi
InfoPathDev India
Shanthi Reddy