My InfoPath form contain a Data Connection to a SharePoint web service:
http://<MyServer>/_vti_bin/UserProfileService.asmx?WSDL
In my code (in the OnLoad event) I try to operate this Data Connection by this code:
function XDocument::OnLoad(eventObj)
{
var objNetwork = new ActiveXObject("WScript.network");
var currentLogin=objNetwork.UserDomain+"\\" +objNetwork.UserName ;
if(XDocument.IsNew) {
var dataObj=XDocument.DataObjects("GetUserProfileByName");
var dataDom=dataObj.DOM;
dataDom.setProperty("SelectionNamespaces", 'xmlns:dfs=http://schemas.microsoft.com/office/infopath/2003/dataFormSolution xmlns:d="http://schemas.microsoft.com/office/infopath/2003/ado/dataFields" ' );
dataDom.selectSingleNode ("/dfs:myFields/dfs:queryFields/s0:GetUserProfileByName/s0:AccountName").text=currentLogin ;
dataObj.Query();
}
}
I try to put "currentLogin" as parameter of the web service, But I get error that:
Reference to undeclared namespace prefix:'s0' .
When I watch the field's tree of this Data Connection (named "GetUserProfileByName") in the Data Source view I have:
MyFields -> queryFields -> s0:GetUserProfileByName -> AccountName.
What is the problem in my code???