S
Stanley
Hi,
i have created the WhoAmI web service to get the username of the current
user using the form. I have added a textbox to the form and bound this to the
secondary datasource which is the whoami web service.
In the on load event of the form i retrieve the username and based on the
user i do something. But appearantly in the on load event this datasource has
not yet been fired so the username has not been retrieved when i want to do
the conditional action.
SO i tried to solve this by executing the datasource in code and retrieve
the username through the DOM with following code:
thisXDocument.DataObjects["GetUser"].Query();
ADOAdapterObject adapt =
(ADOAdapterObject)thisXDocument.DataObjects["GetUser"].QueryAdapter;
IXMLDOMDocument3 oSecondDoc =
(IXMLDOMDocument3)thisXDocument.DataObjects["GetUser"].DOM;
oSecondDoc.setProperty("SelectionNamespaces","xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\"
xmlns:d=\"http://schemas.microsoft.com/office/infopath/2003/ado/dataFields\"");
IXMLDOMNode oSecDocNode =
oSecondDoc.selectSingleNode("/dfs:myFields/dfs:dataFields");
//loop through oSecDocNode:
foreach (IXMLDOMNode oN in oSecDocNode.childNodes)
{
if (oN.nodeType == DOMNodeType.NODE_ELEMENT)
{
strUser = oN.selectSingleNode("@UserName").text;
}
}
But than i get a cast error. So can't i cast a sec. datasource which is a
web service to an "ADOAdapterObject"? How can i read this web service?
Thnx,
Stanley
i have created the WhoAmI web service to get the username of the current
user using the form. I have added a textbox to the form and bound this to the
secondary datasource which is the whoami web service.
In the on load event of the form i retrieve the username and based on the
user i do something. But appearantly in the on load event this datasource has
not yet been fired so the username has not been retrieved when i want to do
the conditional action.
SO i tried to solve this by executing the datasource in code and retrieve
the username through the DOM with following code:
thisXDocument.DataObjects["GetUser"].Query();
ADOAdapterObject adapt =
(ADOAdapterObject)thisXDocument.DataObjects["GetUser"].QueryAdapter;
IXMLDOMDocument3 oSecondDoc =
(IXMLDOMDocument3)thisXDocument.DataObjects["GetUser"].DOM;
oSecondDoc.setProperty("SelectionNamespaces","xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\"
xmlns:d=\"http://schemas.microsoft.com/office/infopath/2003/ado/dataFields\"");
IXMLDOMNode oSecDocNode =
oSecondDoc.selectSingleNode("/dfs:myFields/dfs:dataFields");
//loop through oSecDocNode:
foreach (IXMLDOMNode oN in oSecDocNode.childNodes)
{
if (oN.nodeType == DOMNodeType.NODE_ELEMENT)
{
strUser = oN.selectSingleNode("@UserName").text;
}
}
But than i get a cast error. So can't i cast a sec. datasource which is a
web service to an "ADOAdapterObject"? How can i read this web service?
Thnx,
Stanley