How do I retrieve the correct ID in a SharePoint List using
vb code after submission and after the form has been signed. I am trying to read and populate the ID field in my form so it can be printed out with a unique ID in that field.
I have the data connection setup correctly, but right now it only returns the first ID in the list. I don't necessarily want the last one in the list, because it may or may not be the last ID in the list. Please help!
This is a browser enabled form.
I am using the following code: but get the invalid token error
' Retrieve the value of the control number
Dim TSRNum As String = xnMyForm.SelectSingleNode("/my:myFields/my:TSRControlNum", ns).Value
' Retrieve a reference to the SharePoint list
Dim xPath As XPathNavigator = DataSources("TSRData").CreateNavigator()
' Search for the id in the SharePoint list
Dim SharePointID As XPathNavigator = xPath.SelectSingleNode("/my:myFields/my:TSRControlNum[@TSRID", ns)
'Dim SharePointID As XPathNavigator = xPath.SelectSingleNode("/dfs:myFields/dfs:dataFields/dfs:TSRData/@TSRID[ /my:myFields/my:TSRControlNum = current()]")
'Check whether the search returned a result
Dim IDRes As String = String.Empty
If SharePointID IsNot Nothing Then
IDRes = SharePointID.SelectSingleNode("@TSRID", ns).Value
End If
xnMyForm.SelectSingleNode("/my:myFields/my:TSRControlNum", ns).SetValue(IDRes)
Thanks for any help.