开发者

SharePoint List Data as XML String

I am trying to use the GetListItems web ser开发者_Go百科vice method to retrieve all the items of a list. The method is raising an InvalidOperation exception with the message being "There is an error in XML document". It seems that at least one of the column values contains "illegal" hex values...at least as far as XML Nodes go.

Besides pulling back each item one at a time (and skipping the "bad" item), is there a way to get at the raw XML data returned by GetListItems? My thought is that if I have the raw string I can try to sanitize it before converting it to XML Nodes (and then later into a DataTable).

Any other ideas would be appreciated.

Thanks

Jason


Can you validate that the data being returned is actually the correct XML data and not an HTML error page such as a 401 or 404 error page?


@Jason I could not reproduce the problem exactly as you described but I would like to try this technique:

  1. Check in your VisualStudio , Option, Debugging, General, unchek the option "Enable Just My Code"
  2. Reveal your autogenerate Reference.cs , position the cursor where you call the GetListItems ( i.e XmlNode ndListItems = listService.GetListItems(sList, null, ndQuery, ndViewFields, "0" , ndQueryOptions, null); and then pres F12 ( Go To Definition)

    1. Put a breakpoint (and a watchpoint) or even change the code autogenerated; here you could be able to inspect (quick watch, or your favorite tecnique) the objec[] restults returned by the invocation i.e:

      [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/GetListItems", RequestNamespace="http://schemas.microsoft.com/sharepoint/soap/", ResponseNamespace="http://schemas.microsoft.com/sharepoint/soap/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
      public System.Xml.XmlNode GetListItems(string listName, string viewName, System.Xml.XmlNode query, System.Xml.XmlNode viewFields, string rowLimit, System.Xml.XmlNode queryOptions, string webID) {
      object[] results = this.Invoke("GetListItems", new object[] {
                  listName,
                  viewName,
                  query,
                  viewFields,
                  rowLimit,
                  queryOptions,
                  webID});
      
      Debug.WriteLine(results.Length);
      
      return ((System.Xml.XmlNode)(results[0]));
      

      }

I look forward to know if this can help you better identify or solve the problem

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜