Set field in code. Infopath 2007

B

Bob C.

I'm trying the following code to set a field named Editor:

Dim myXNav As System.Xml.XPath.XPathNavigator =
Me.MainDataSource.CreateNavigator

Me.MainDataSource.SetNamedNodeProperty(myXNav,
"/ns3:myFields/ns3:MJQualityIndicator", Application.User.UserName.ToString)

The problem is "/ns3:myFields/ns3:MJQualityIndicator" is returning an
invalid argument error.

Do I have to identify the ns3 namespace somehow?



Heres the document

<?xml version="1.0" encoding="UTF-8"?>
<?mso-infoPathSolution solutionVersion="1.0.0.1087" productVersion="12.0.0"
PIVersion="1.0.0.0"
href="file:///C:\Users\me\AppData\Local\Microsoft\InfoPath\Designer2\813317f2c6347ce\manifest.xsf" language="en-us" ?>
<?mso-application progid="InfoPath.Document"
versionProgid="InfoPath.Document.2"?>
<ns3:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"
xmlns:ns1="http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-01-05T14:10:19"
xmlns:ns3="http://schemas.microsoft.com/office/infopath/2003/my/2006-01-05T14:10:19"
xmlns:tns="http://mjsc-int.com"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:_xdns0="http://schemas.microsoft.com/office/infopath/2003/changeTracking"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:ns2="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"
xmlns:msprop="urn:schemas-microsoft-com:xml-msprop"
xmlns:ns4="urn:mdWebService"
xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-01-03T22-13-40" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003">
<ns3:MJEnterpriseID> 2007-08-08T10:12:35</ns3:MJEnterpriseID>
<ns3:MJEnterpriseIDRelatedMaster></ns3:MJEnterpriseIDRelatedMaster>
<ns3:MJEnterpriseLastReviewDate></ns3:MJEnterpriseLastReviewDate>
<ns3:MJEnterpriseStatus></ns3:MJEnterpriseStatus>
<ns3:MJPrivate></ns3:MJPrivate>
<ns3:MJQualityIndicator></ns3:MJQualityIndicator>

<ns3:AutoResolvedWinner></ns3:AutoResolvedWinner>
<ns3:HasPicture></ns3:HasPicture>
</ns3:myFields>
 
B

Bob C.

Thanks, but this looks like 2003 based code. I'm working in 2007. I'll see,
though, if this leads to an answer.
 
B

Bob C.

This syntax works, though.
ls_text =
mainDomNavigator.SelectSingleNode("/ns3:myFields/ns3:MJEnterpriseID",
NamespaceManager).Value.ToString
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top