c# - 如何从 infoPath 表单到 Sharepoint 库生成具有唯一 ID 的名称? C#

标签 c# forms visual-studio-2012 sharepoint infopath2010

我用 C# 代码制作了一个提交按钮,该按钮从信息路径表单提交到 SharePoint 库。在 infopath 表单中,我有一个字段,您必须键入名称。名称必须始终相同应该生成一个 ID,最后将名称添加为 john 001john 002john 003 等。 我的信息路径形式: enter image description here

我在 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;

我该怎么做

最佳答案

string formName = "Kerkesa"+ random(); 我在找这个

在 random() 函数上有一个 GUID 生成器

关于c# - 如何从 infoPath 表单到 Sharepoint 库生成具有唯一 ID 的名称? C#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34307473/

相关文章:

javascript - 用以前保存的元素替换元素(选择框)

php - Wordpress:在管理选项页面上传图片

php - "Warning: in_array() expects at most 3 parameters, 5 given"尝试上传文件时

visual-studio-2012 - msdeploy 错误 ERROR_USER_UNAUTHORIZED : Web deployment task failed. 使用 IIS7、TFS2010、VS2012

c# - 隐藏主窗体,启动新窗体,在不关闭第二窗体的情况下在两者之间切换

c# - 如何汇总数据库中给定日期的多个时间记录。错误 :Subquery returned more than 1 value

c# - setter/getter setter 数组

c# - 使用 URL 重写从 URL 中删除 .aspx 扩展名

c# - Windows 应用程序已停止在客户端计算机中工作

keyboard-shortcuts - 使用 Visual Studio 2012 将键盘快捷键附加到解决方案资源管理器中的 'Collapse All' 项