Sets the value of a named property for the supplied XML node, which must be a nonattribute node in the main data source.
expression.SetNamedNodeProperty(ByVal pxmlMainDOMNode As IXMLDOMNode, ByVal bstrPropertyName As String, ByVal bstrValue As String)
expression Required. An expression that returns a reference to an XDocument object.
pxmlMainDOMNode Required IXMLDOMNode. An XML node corresponding to a nonattribute node in the main data source, for which a named property is to be set.
bstrPropertyName Required String. Specifies the name of the property being set.
bstrValue Required String. Specifies the value to which the property will be set.
Security Level
2: Can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.
Remarks
Named properties allow users to associate strings with user-defined properties of XML element nodes in the main data source. The value of a named property can be set by using the SetNamedNodeProperty method. Use the GetNamedNodeProperty method to read the value of a named property.
Note This object model member is not supported when the Disable Service Pack features option on the Advanced tab of the Options dialog box in InfoPath is selected or when Microsoft Office 2003 Service Pack 1 or later is not installed. Any form that implements this object model member in its code will generate an error message if it is opened in InfoPath when service pack features are disabled or unavailable.
Example
In the following example, the value of a named property (with the name "cost") of an XML node (called "item") is set by using the SetNamedNodeProperty method:
var objXMLNode = XDocument.DOM.selectSingleNode("/items/item");
XDocument.SetNamedNodeProperty(objXMLNode, 'cost', '100');
var strTest = XDocument.GetNamedNodeProperty(myNode, 'cost', 'empty');