2

I have made a submit button with c# code that submits from infopath form to SharePoint library. In infopath form I have a field and you have to type name. Name must be always the same john How can i make after name to generate a unique number for each name that is typed I.E, I add a name as following: john the code should generate an ID, finally name will be added as john 001,john 002, john 003 etc. My infopath form: enter image description here

My code for submit in c#:

XPathNavigator root = MainDataSource.CreateNavigator();

// Generate a name for the form to be saved in SharePoint
string formName =  Guid.NewGuid().ToString();

// Set the name of the form on the data connection
root.SelectSingleNode(
   "//my:formName ", NamespaceManager).SetValue(formName);

// Submit the form to SharePoint
DataConnection spConn =
DataConnections["SharePoint Library Submit"];
spConn.Execute();
 e.CancelableArgs.Cancel = false;

How can i do that

Nderon Hyseni
  • 247
  • 2
  • 18

1 Answers1

1

string formName = "Kerkesa" + random(); i was looking for this

And on the random() function there is a GUID GENERATOR

John Champion
  • 147
  • 2
  • 2
  • 12
Nderon Hyseni
  • 247
  • 2
  • 18