我需要以编程方式编辑Sharepoint表单以更新表单上的文本框。此表单的网址为https://sharepointserver/NameOfList/DispForm.aspx?ID=141
。使用sharepoint Web服务如何将数据添加到表单上的“描述”字段?
答案 0 :(得分:0)
首先 - 向您的visual studio项目添加一个Web服务,以便从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服务。