Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在客户端上以编程方式将数据添加到sharepoint表单_C#_Sharepoint_Sharepoint 2007 - Fatal编程技术网

C# 在客户端上以编程方式将数据添加到sharepoint表单

C# 在客户端上以编程方式将数据添加到sharepoint表单,c#,sharepoint,sharepoint-2007,C#,Sharepoint,Sharepoint 2007,我需要以编程方式编辑Sharepoint表单,以更新表单上的文本框。此表单的url为https://sharepointserver/NameOfList/DispForm.aspx?ID=141。使用sharepoint web services如何将数据添加到表单上名为“描述”的字段?首先-将web服务添加到visual studio项目,以便从windows/console应用程序与sharepoint交互: 然后调用WssLists string strBatch=”“+ "141" +

我需要以编程方式编辑Sharepoint表单,以更新表单上的文本框。此表单的url为
https://sharepointserver/NameOfList/DispForm.aspx?ID=141
。使用sharepoint web services如何将数据添加到表单上名为“描述”的字段?

首先-将web服务添加到visual studio项目,以便从windows/console应用程序与sharepoint交互:

然后调用WssLists

string strBatch=”“+
"141" +
“我的新描述”+
""; 
XmlDocument xmlDoc=new System.Xml.XmlDocument();
System.Xml.xmlement elBatch=xmlDoc.CreateElement(“批处理”);
elBatch.SetAttribute(“OnError”、“Continue”);
SetAttribute(“ListVersion”、“1”);
SetAttribute(“视图名称”,
“0d7fcacd-1d7c-45bc-bcfc-6d7f7d2eeb40”);
elBatch.InnerXml=strBatch;
XmlNode ndReturn=WssLists.updatelistems(“列表名称”,elBatch);

您可以在上看到有许多web服务可用于与SharePoint交互。

在客户端上?这意味着用户输入表单后,数据会在某一点上发生变化吗?是否要以AJAX方式更新列表字段?例如,在使用windows应用程序的客户端上,或在不在浏览器窗口中打开web窗体的控制台应用程序上。
string strBatch = "<Method ID='1' Cmd='Update'>" + 
    "<Field Name='ID'>141</Field>" +
    "<Field Name='Description'>My new Description</Field></Method>" +
    "</Method>"; 

XmlDocument xmlDoc = new System.Xml.XmlDocument();

System.Xml.XmlElement elBatch = xmlDoc.CreateElement("Batch");

elBatch.SetAttribute("OnError","Continue");
elBatch.SetAttribute("ListVersion","1");
elBatch.SetAttribute("ViewName",
    "0d7fcacd-1d7c-45bc-bcfc-6d7f7d2eeb40");

elBatch.InnerXml = strBatch;

XmlNode ndReturn = WssLists.UpdateListItems("List_Name", elBatch);