SharePoint 2007/10列出Web服务,UpdateListItems。列表不存在?

时间:2018-06-15 08:20:10

标签: web-services sharepoint-2010 sharepoint-2007

我问这个问题是SharePoint堆栈交换,但没有人回复。

我正在尝试使用SharePoint Web服务上的UpdateListItems删除SharePoint列表中的项目。

我有以下代码:

public XmlNode DeleteListItems(string listName, string viewName, string pointer)
{
     Program p = new Program();
     using (SharePoint2010PGLists.Lists SPDelete = new SharePoint2010PGLists.Lists()
     {
          Credentials = p.GetSPCredentials(),
          PreAuthenticate = true
     })
     {
          string strBatch = "";
          strBatch += "<Method ID='1' Cmd='Delete'>" +
                          $"<Field Name='ID'>{pointer}</Field>" +
                      "</Method>";
          XmlDocument xmlDoc = new XmlDocument();
          XmlElement elBatch = xmlDoc.CreateElement("Batch");
          elBatch.SetAttribute("OnError", "Continue");
          elBatch.SetAttribute("PreCalc", "true");
          elBatch.SetAttribute("ListVersion", "1");
          elBatch.SetAttribute("ViewName",viewName);

          elBatch.InnerXml = strBatch;
          return SPDelete.UpdateListItems(listName, elBatch);
      }
 }

但是,当响应返回时,XmlNode响应显示以下内容:"0x81020026The list that is referenced here no longer exists."

即使列表确实存在且项目也存在。

我曾尝试过很多以前的帖子,但它们似乎没有用。

有没有人有任何想法我做错了什么?

0 个答案:

没有答案
相关问题