locked
Only a few columns are returned RRS feed

  • Question

  • Hey Guys, I am hoping to get some much needed help here.

    I am using the below code to read the contents of the SP List (with 8 columns). Everything works great, except that I do not get all SP columns in a list (I get only 5). After looking at this for the past 2 hours, I ran out of ideas. Please help me if you can.

     

    thanks in advance

     

     

    XmlDocument xmlDoc = new System.Xml.XmlDocument();

    string SharePointNamespacePrefix = "sp";

    string SharePointNamespaceURI = "http://schemas.microsoft.com/sharepoint/soap/";

    string ListItemsNamespacePrefix = "z";

    string ListItemsNamespaceURI = "#RowsetSchema";

    string PictureLibrariesNamespacePrefix = "s";

    string PictureLibrariesNamespaceURI = "uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882";

    string WebPartsNamespacePrefix = "dt";

    string WebPartsNamespaceURI = "uuid:C2F41010-65B3-11d1-A29F-00AA00C14882";

    string DirectoryNamespacePrefix = "rs";

    string DirectoryNamespaceURI = "urnTongue Tiedchemas-microsoft-com:rowset";

    XmlNamespaceManager NamespaceMngr = new XmlNamespaceManager(xmlDoc.NameTable);

    NamespaceMngr.AddNamespace(SharePointNamespacePrefix, SharePointNamespaceURI);

    NamespaceMngr.AddNamespace(ListItemsNamespacePrefix, ListItemsNamespaceURI);

    NamespaceMngr.AddNamespace(PictureLibrariesNamespacePrefix, PictureLibrariesNamespaceURI);

    NamespaceMngr.AddNamespace(WebPartsNamespacePrefix, WebPartsNamespaceURI);

    NamespaceMngr.AddNamespace(DirectoryNamespacePrefix, DirectoryNamespaceURI);

    XmlNode ndQuery = xmlDoc.CreateNode(XmlNodeType.Element,"Query","");

    XmlNode xNodeValues;

    ndQuery.InnerXml = "<Where><Eq><FieldRef Name='Employee_x0020_Number' /><Value Type='Text'>100</Value></Eq></Where>";

    XmlNode xItems = l.GetListItems("Emp List", null, ndQuery, null, "100", null, null);

    Tuesday, May 22, 2007 6:46 PM

Answers

  • Hi there

     

    When using the webservice to return data from lists you only get columns that contains data. Empty columns are not returned, which I think is a way to minimize the information send over the wire to make the communication with the server more responsive BUT it would have been much more versatile if Microsoft had made that behavior optional cause I find lot of scenarios where the program consuming the webservice expect to receive data in exact same format for every record.

     

    Happy coding

    Henrik Sørensen

    OPTION Denmark

    Tuesday, May 22, 2007 8:21 PM

All replies

  • Hi there

     

    When using the webservice to return data from lists you only get columns that contains data. Empty columns are not returned, which I think is a way to minimize the information send over the wire to make the communication with the server more responsive BUT it would have been much more versatile if Microsoft had made that behavior optional cause I find lot of scenarios where the program consuming the webservice expect to receive data in exact same format for every record.

     

    Happy coding

    Henrik Sørensen

    OPTION Denmark

    Tuesday, May 22, 2007 8:21 PM
  • Henrik,

    Thank you very mucn. Your are right! the columins which I do not see are the ones with no data.

    I agree with you that microsoft made it optional.

     

    Members, Please let us know if there is a way to overide this behavior? I am trying to get all the cloumns irrespective of whether it contatins value or not.

     

    Thanks for your help.

    Tuesday, May 22, 2007 8:39 PM
  • I have similar problem, I found that the web service doesn't return data from calculated column. Is it by design?

    Thanks
    Wednesday, May 23, 2007 2:14 AM