Retrieving data from a sharepoint list using CAML query - returning uneeded fields

Please support our RSS, Web Services and SOAP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Oct 2008
Posts: 41
Reputation: julseypart is an unknown quantity at this point 
Solved Threads: 0
julseypart julseypart is offline Offline
Light Poster

Retrieving data from a sharepoint list using CAML query - returning uneeded fields

 
0
  #1
34 Days Ago
hi, i am trying to retreive data from a sharepoint list but its returns all columns such as ows_MetaInfo, ows__ModerationStatus ,ows__Level ows_ID ,ows_owshiddenversion, ows_UniqueId ,ows_FSObjType
rather than just the fields i want from the list.
I thought the "<IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns> tag would filter these colums out

Can any1 help?
heres my code:

RSS, Web Services and SOAP Syntax (Toggle Plain Text)
  1. webreference.Lists myList = new webreference.Lists();
  2.  
  3. myList.Credentials = new NetworkCredential(Username, Password, Domain);
  4. // myList.Url = "http://193.82.85.1/HelpDesk/_vti_bin/lists.asmx";
  5.  
  6. XmlDocument xmlDoc = new XmlDocument();
  7.  
  8. XmlNode ndQuery = xmlDoc.CreateElement("Query");
  9.  
  10. XmlNode ndViewFields = xmlDoc.CreateElement("ViewFields");
  11. XmlNode ndQueryOptions = xmlDoc.CreateElement("QueryOptions");
  12.  
  13. ndQueryOptions.InnerXml = "<IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns>" + "<DateInUtc>FALSE</DateInUtc>" + "<IncludeAttachmentUrls>TRUE</IncludeAttachmentUrls>/>";
  14.  
  15.  
  16. ndViewFields.InnerXml = "<FieldRef Name='Title' /> <FieldRef Name='SRDetail'/> <FieldRef Name='Priority'/> <FieldRef Name='Raised_x0020_By'/> <FieldRef Name='Date_x0020_Raised'/> <FieldRef Name='Category'/> <FieldRef Name='Centre'/> <FieldRef Name='ResolutionType' />";
  17. ndQuery.InnerXml = "<OrderBy><FieldRef Name='Date_x0020_Raised'/></OrderBy>";
  18.  
  19. //"<Query><Where><Eq><FieldRef Name='Raised_x0020_By' /><Value Type='Text'>ddlRaisedBy.Value</Value></Eq></Where></Query>"
  20.  
  21. XmlNode nodeListItems = myList.GetListItems("{002DD75F-2F5A-407C-95A7-2C8CC7156C58}", "{3D3A5BB0-4994-4D64-891C-24D6ECB31991}", ndQuery, ndViewFields, "5", ndQueryOptions, null);
  22. XmlReader reader = new XmlNodeReader(nodeListItems);
  23.  
  24.  
  25. DataSet ds = new DataSet();
  26. ds.ReadXml(reader);
  27.  
  28.  
  29. // GridView1.DataMember = "yourmembers";
  30. GridView1.DataSource = ds.Tables[1];
  31. GridView1.DataBind();

cheers
Last edited by julseypart; 34 Days Ago at 8:22 am.
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC