944,194 Members | Top Members by Rank

Ad:
Oct 23rd, 2009
0

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

Expand Post »
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:

XML, XSLT and XPATH 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> <ViewAttributes Scope='Recursive' />";
  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.DataSource = ds.Tables[1];
  30. GridView1.DataBind();

much appreciated
Last edited by julseypart; Oct 23rd, 2009 at 7:52 am.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
julseypart is offline Offline
42 posts
since Oct 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in XML, XSLT and XPATH Forum Timeline: XML Feed Problem with £ and ' any ideas.... anyone???
Next Thread in XML, XSLT and XPATH Forum Timeline: Following XSLT Logic Not Working





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC