2011-09-28 89 views
0

我需要以编程方式编辑Sharepoint窗体来更新窗体上的文本框。该表格的网址是https://sharepointserver/NameOfList/DispForm.aspx?ID=141。使用SharePoint Web服务如何将数据添加到窗体上名为“说明”的字段?以编程方式将数据添加到客户端

+0

在客户端?这意味着在用户输入表单之后,在某些时候数据会发生变化?你想以AJAX的方式更新列表字段? –

+0

在使用Windows应用程序的客户端或控制台应用程序中,无需在浏览器窗口中打开Web窗体。 – Josh

回答

0

首先 - 添加Web服务到您的Visual Studio项目与从Windows /控制台应用程序的SharePoint互动:Accessing SharePoint Web-Services with Visual Studio 2008

然后调用WssLists。 UpdateListItems

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); 

你可以看到MSDN有可用来与SharePoint互动很多Web服务。

相关问题