.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Post New Web Links

Using GetListItems() with QueryOption

Posted By:      Posted Date: September 13, 2010    Points: 0   Category :SharePoint
Hi, I am trying to retrieve an item which the document name is "test.txt" from a doc library. I used Lists.asmx and was able to retrieve all items using GetListItems(). Now, I added QueryOption like so to add filtering: XmlDocument xmlDoc = new System.Xml.XmlDocument(); XmlNode query = xmlDoc.CreateNode(XmlNodeType.Element,"Query",""); XmlNode viewFields = xmlDoc.CreateNode(XmlNodeType.Element,"ViewFields",""); XmlNode queryOptions = xmlDoc.CreateNode(XmlNodeType.Element,"QueryOptions",""); queryOptions.InnerXml = "<IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns>" + "<DateInUtc>TRUE</DateInUtc>"; viewFields.InnerXml = "<FieldRef Name='LinkFilename'/>"; query.InnerXml = "<Where><Eq><FieldRef Name='LinkFilename'/><Value Type='Text'>test.txt</Value></Eq></Where>"; XmlNode items = listOperator.GetListItems("My Doc Library", null, query, viewFields, null, queryOptions, null); But, it still returns ALL items. What could be the reason the filtering is not applied?? Thanks.

View Complete Post

More Related Resource Links

How to sync between UpdateListItems() and GetListItems() web services

I am using Javascript to call the UpdateListItems() webservice through SOAP to add an entry to a list then I am using the GetListItems() webservice to query the number of items in that list. I am successful in adding an new entry in the list, but when I query the GetListItems(), it does not return the number of entries (items) in the list unless it was entered via the SharePoint GUI, not the UpdateListItems() routine I have written. I will add the source code for your reference and help.: var response; function SOAPUtilForHitCount(data,action,listName,listPath) { this.data = data; this.listName = listName; this.listPath = listPath; this.SOAPHeader =  function() { var stack = []; stack.push("<?xml version='1.0' encoding='utf-8'?>"); stack.push("<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>"); return (stack.join("")); } this.SOAPBody =  function() { var stack = []; if(action=="count") { stack.push("<soap:Body>"); stack.push("<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>"); stack.push("<listName>" + this.listName + "</listName><query><Query xmlns=''><Where><Eq><Fie

SP Webservice:Lists.GetListItems

i want to get all list items in "test" list Lists.GetListItems("test", null,null,null,null,null,null), but it returns only the first page. about Lists.GetListItems Method http://msdn.microsoft.com/en-us/library/lists.lists.getlistitems.aspx, in the "Remarks",  "includes a ListItemCollectionPositionNext attribute inside the rs:Data element", i can find the node but how can i get the next page items? any help?  

Sorting GetListItems method using Jquery

Hi, I am getting the list item collection by using jquery but I am unable to do sorting based on the ows_ID. Any one can help me? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="refresh" content="120"> <title></title> <script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script> <script type="text/javascript"> $(document).ready(function () { var soapEnv = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \ <soapenv:Body> \ <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \ <listName>ListName</listName> \ <viewFields> \ <ViewFields> \ <FieldRef Name='Created' /><FieldRef Name='Modified' />\ </ViewFields> \ </viewFields> \ <rowLimit>5</rowLimit>\ <strong> <OrderBy><FieldRef Name='ows_ID' Descending='True' /></OrderBy>\</strong> </GetListItems> \ </soapenv:Body> \ </so

GetListItems - how to get ALL rows?

Greetings GetListItems has a mandatory row limit, one person once said it isnt mandatory, but if i dont specify it, it will use ANOTHER limit set somewhere in the list settings inside sharepoint. I need to get ALL the rows from the list. Using Query isnt an option since Query does not return ID's of the fieds that are linked fields.  Is there a way to either override the row limit to infinity or to get "X rows after Y rows", like, not first 10 rows but rows from 11 to 20, like when you view a forum page?

Why is GetListItems returning rubbish as field names?

Always wondered, why? I need to write a complex SSIS package that will copy all of the sharepoint lists into sql database (because M$ were too stupid to let users do rich reporting on the sharepoint server, you have to dupe the lists into another database to do reports on them) Problem is, if i query for list, i get something like this: <Field Type="User" DisplayName="??? ??????????" List="UserInfo" Required="FALSE" ShowField="ImnName" UserSelectionMode="PeopleOnly" UserSelectionScope="0" Group="??????????м?? ???????" ID="{888f100e-1488-4662-af86-413a05dc3506}" SourceID="{bfad9184-4660-4714-a773-b2803c9941f3}" StaticName="???_x0020_??????????" Name="_x0424__x0418__x041e__x0020__x04" Hidden="FALSE" Customization="" ReadOnly="FALSE" PITarget="" PrimaryPITarget="" PIAttribute="" PrimaryPIAttribute="" Aggregation="" Node="" ColName="int1" RowOrdinal="0" /> <Field Type="DateTime" DisplayName="?????? ?" Required="TRUE" Format="DateOnly" Group="??????????м?? ???????" ID="{635dd517-ab59-4cd3-91eb-54a1f679a07b}" SourceID="{bfad9184-4660-4714-a773-b2803c9941f3}" StaticN

Xmlnode to Dataset/DataTable (GetListItems Sharepoint Webservices)


How to convert XmlNode to Dataset or Datatable and below is my code..

 DataSet dsList = new DataSet();

            Web_Reference.Lists listService = new Web_Reference.Lists();

            listService.PreAuthenticate = true;
            NetworkCredential Cred = new NetworkCredential();
            Cred.Domain = Domain;
            Cred.UserName = Login;
            Cred.Password = password;

            listService.Credentials = Cred;

            string listName = "{0F775034-47EA-486F-97AE-50C5BD9011B0}";
            string viewName = "{8F441557-E75B-4BAC-A3EF-B61FF0351DBE}"; ;
            XmlDocument xmlDoc = new System.Xml.XmlDocument();

            System.Xml.XmlNode ndQuery = xmlDoc.CreateNode(System.Xml.XmlNodeType.Element, "Query", "");
            System.Xml.XmlNode ndViewFields = xmlDoc.CreateNode(System.Xml.XmlNodeType.Element, "ViewFields", "");
            System.Xml.XmlNode ndQueryOptions = xmlDoc.CreateNode(System.Xml.XmlNodeType.Element, "QueryOp

Web service's method GetListItems fails with error "'_', hexadecimal value 0x0B, is an invalid ch


We are developing ASP.NET web application that interacts with SharePoint via web services. At some our customers' systems we encountered the following problem.
Web method GetListItems throws an exception :
 ' ', hexadecimal value 0x0B, is an invalid character. Line 42, position 31.

Stack trace of exception you can see below:
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at ITSMS.DAL.SPLists.Lists.GetListItems(String listName, String viewName, XmlNode query, XmlNode viewFields, String rowLimit, XmlNode queryOptions, String webID)

INNER MESSAGE: ' ', hexadecimal value 0x0B, is an invalid character. Line 42, position 31.

   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.Throw(St

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend