SharePoint Developer Center > SharePoint Products and Technologies Forums > SharePoint - Development and Programming > ListService.GetListItems() throwing exception for invalid character
Ask a questionAsk a question
 

AnswerListService.GetListItems() throwing exception for invalid character

  • Wednesday, November 04, 2009 5:11 PMcyrix86 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    this line throws the exception

    XmlNode result = listService.GetListItems("PageList", null, query, viewFields, "5000", queryOpt, null);
    
    the exception info is:

    [System.InvalidOperationException] = {"There is an error in XML document (2978, 6080)."}
    InnerException = {"'', hexadecimal value 0x05, is an invalid character. Line 2978, position 6080."}
    Source = "System.Xml"
    StackTrace = "   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)\r\n   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)\r\n   at System.Web....
    TargetSite = {System.Object Deserialize(System.Xml.XmlReader, System.String, System.Xml.Serialization.XmlDeserializationEvents)}


    this is site-specific, I've run the same method with the list service pointing to other sites and it works fine

Answers

  • Friday, November 06, 2009 11:32 AMMarkus I_ Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Cyrix

    it seems to be one of your items that makes the trouble and not the list schema itself.

    Inside the query to to order the result by ItemID and then try it with increasing rowlimit- until you get the last ItemID that work. Then search for the item with the following ItemID and have a closer look at it.
    • Marked As Answer bycyrix86 Monday, November 16, 2009 8:55 PM
    •  

All Replies

  • Wednesday, November 04, 2009 5:55 PMSteve.CurranMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Is this in the soap exception being returned?
    What kind of list is PageList?
    Do any of the fields that you list in viewFields contains xml or html?
    certdev.com
  • Wednesday, November 04, 2009 7:22 PMcyrix86 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    The fields in my viewFields expression do not contain any xml or html. The only field returned that contains html/xml is the ows_MetaInfo field which I think is a system field. Even so, i've tried the method on other sites and no problems.
  • Thursday, November 05, 2009 3:42 PMcyrix86 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    This only happens on one site out of 132

  • Thursday, November 05, 2009 3:52 PMMarkus I_ Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Cyrix, can you narrow down the query so that no results should be read? It would be of interest whether it is a list-problem.

    If everything's Ok then try to "open" the query piece by piece in order to get list item that causes the trouble.

  • Thursday, November 05, 2009 4:48 PMcyrix86 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I've set everything to null in the getlistItems call except for the list name "Pages", and it works. As soon as I add the rowlimit string it fails.
    When the row limit is null, the result set is only 50 rows - which is what the list is paged by.
    If I set the row limit to 95 or anything above 95 the method throws the error listed above.
    Even setting the row limit to 94 works.

    So the query/viewfields have nothing to do with the error. It's something wierd with the row limt. I'm at a loss here.

    And btw, the getlistitems method with all parameters works with other lists on this site. the "pages" list is the only list with the issue.
  • Friday, November 06, 2009 11:32 AMMarkus I_ Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Cyrix

    it seems to be one of your items that makes the trouble and not the list schema itself.

    Inside the query to to order the result by ItemID and then try it with increasing rowlimit- until you get the last ItemID that work. Then search for the item with the following ItemID and have a closer look at it.
    • Marked As Answer bycyrix86 Monday, November 16, 2009 8:55 PM
    •  
  • Monday, November 16, 2009 8:55 PMcyrix86 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Yes a document in the list had a field with non printable control characters in it. Thanks for the help