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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

CAML Query - DateTime

Posted By:      Posted Date: September 21, 2010    Points: 0   Category :SharePoint
I wish to take data from the list, satisfying to the certain time range (BeginDate.....DateTime.....EndDate). How it can be made?

View Complete Post

More Related Resource Links

Regional settings impacts Caml DateTime query



I am using the GetListItems web service to retrieve items from a list where my custom column UpdateCompleted is less than or equal to a given datetime. But, I noticed some weird behaviour of SharePoint 2007 going on. The query would perform differently when I changed my regional settings on the site settings page of SharePoint! When regional settings were set to UTC my query would select the items, when in GMT it would not.

I have specified my query to use a DateTime in UTC form (ends with Z) and I have also specified DateInUtc to TRUE in the query options. So I would expect SharePoint to do a UTC date compare despite what the site regional settings are set to.

This is my query:

<Query><Where><And><Eq><FieldRef Name='Status'></FieldRef><Value Type='Text'>Unlocked</Value></Eq><Leq><FieldRef Name='UpdateCompleted'></FieldRef><Value Type='DateTime' IncludeTimeValue='TRUE'>2010-10-08T18:40:21Z</Value></Leq></And></Where></Query>

This is my query options:

How to join two sharepoint list in c# by CAML query?

Hii All,
   I am using wss 3.0 and i have one site and site has 4 to 5 lists. lists are interconnected with lookup column and same column. I need to display some column fron one list and some from another.. i need to join that lists by where condition like project =project..

So how can i join??

Thank You

DateTime custom managed property search fails with " Your query is malformed. Please rephrase your q

I've created a front end search page in Silverlight 4 for SharePoint Search.  Currently we are using WSS 3.0 + Search Server Express 2008 (v  The page interacts with the MOSS version of the search web service at:   <site collection>/_vti_bin/search.asmx The reason for this approach is the unique way the requirements specify the look and behavior of the results.  The built-in Search Center page or web parts will not satisfy these requirements. We are going into production but I still cannot figure out how to search against my custom managed properties that are of Type DateTime.  If I cannot get this to work, it is a showstopper. I've tried numerous variations on the SQL Syntax and cannot get it to work.  I know the error is in the date portion of the WHERE clause since I can remove it and searches work fine. Here is a working query: SELECT Size, Rank, Path, Title, Description, Write, RequestSubmittedDate, DocumentType, RequestPromisedDate, ProblemDescription, DatePublished, RequestOwner, RequestingDepartment, DocumentAuthor, ProjectNumber, ProjectDescription, RequestStatus FROM scope() WHERE CONTAINS ('"nmr"') ORDER BY "Rank" DESC yet if I try to use a date literal in the WHERE clause as in the following query modification, I get the "malformed"

Any way to execute a workflow when a caml query returns zero items?

Lets say I have a list with a status column and I want to execute a workflow when all items in the list have a status of complete. I basically want to execute a workflow when the caml query looking for non-complete statuses returns zero rows. Can I do this with SPD or are there any 3rd party tools for this? I'm thinking of writing one if there are not.

Caml query not working

Hi, I'm trying to query a SPListItem from a sharepoint list but it doesn't seem to work:   SPDocumentLibrary myDocuments = (SPDocumentLibrary)site.Lists["Documents"]; SPQuery query = new SPQuery() { Query = " <Where>" + " <Eq>" + " <FieldRef Name='DocumentPath' />" + " <Value Type='Text'>" + source + "</Value>" + " </Eq>" + " </Where>" }; var result = myDocuments.GetItems(query); I get no result, but there's an item with the specified "source" that does exist.

Need help in CAML Query - Sort Operation

hi I have a list column "DisplayOrder" in which i have integer values, i am using this query <Query><OrderBy><FieldRef Name="DisplayOrder" Ascending="True" /></OrderBy></Query> this returns me listcollection 1 10 15 2 it is considering the colums as string, can i convert this column to integer before sorting? i want this result 1 2 10 15

Sorting SPListItemCollection using CAML Query?

Hi, I have a SPListItemCollection from all the list items from a list I retrieve programmatically, is there a way that I can sort by the Title alphabetically?  or sort by date descending? Is there a way to do this?  Can CAML Query do this?  Thanks.

Issue with CAML Query

I am having a RadGrid in Sharepoint Webpart with each row having a checkbox and multiple Columns where one of the Columns is ColumnID. When a multiple checkboxes are selected, their respective ColumnID Value is used to Query and generate report. I am using CAML Query to pass in the ColumnID of each checkbox selected and generate report based on the ColumnID Value. But I am having issue with the Query I have written. I have tried two ways: One of the ways was to Hardcode just two ColumnID Values as I was not sure how to read array of multiple columnID values. But I was wondering where I was going wrong since it was throwing following error: "Multiple with same name ColumnID were used" Telerik.Reporting.ReportParameter param1 = new Telerik.Reporting.ReportParameter(); param1.Name = "ColumnID"; param1.Type = Telerik.Reporting.ReportParameterType.Integer; param1.AllowBlank = false; param1.AllowNull = true; param1.Text = "ColumnID"; param1.Visible = true; param1.Value = "200"; this.ReportParameters.Add(param1); Telerik.Reporting.ReportParameter param2 = new Telerik.Reporting.ReportParameter(); param2.Name = "ColumnID"; param2.Type = Telerik.Reporting.ReportParameterType.Integer; param2.AllowBlank = false; param2.AllowNull = true; param2.Text = &qu

Get datetime max and min value in a sql query

Hi,I'm building an asp.net application and have a problem. Im building now a stored procedure in sql server and need the min (1/1/0001) and max(12/31/9999) value of the datetime. Is there some method I can execute to get this dates?Thank you

caml query builder for wss 3 site

hi, is there a caml query builder that can be use for WSS 3.0 sites?

CAML query on external list is not working

Hi, I have an external list, display data from SQLServer 2008. Table on SQL have an UniqueIdentifire (GUID) type column as a Primary key. It also has one identifier column, Its value is increased by 1, as the item is created. In share point server side code, I want to fetch single record against the primary key GUID value. I write down the CAML query on GUID column and run without any error. But all the external list data is returned instead of Single list item. I also try to filter on Auto Incremented column, but same problem is occurred.

CAML query to access List data across multiple site collection.

Hi   Is there any way to get the Task List data across multiple site collection using CAML query. Currently, I have the code which will retrieve the data from a single site collection. Below is the code.                           /***************************************************I am using Moss2007.Thanks!Ravi             SPSiteDataQuery q = new SPSiteDataQuery();             q.ViewFields = "<FieldRef Name=\"Title\" />" "<FieldRef Name=\"Status\" Nullable=\"TRUE\"/>";             q.Lists = "<Lists ServerTemplate=\"107\"/>";             q.Webs = "<Webs Scope=\"SiteCollection\"/>";             q.Query = "<Where>" +                                "<Eq>" +                                     "<FieldRef Name=\"Status\" />" + "<Value Type=\"Choice\">Not  Started</Value>" +                                     "</Eq>" +                         "</Where>";             DataTable dt=null;             using (SPSite s = new SPSite("http://banglabguest1:31000/"))             {                 SPWeb w = s.OpenWeb();                 dt = w.GetSiteData(q);                 w = null;             }                              *************************

CAML query to pick docs where modified is older than today.


Hi I am looking for a CAML query which will return all documents throughout the site collection
for docs which have a Modified that have past today.
I cant seem to do this.

I have a query so far as this and it comes up with an error 'The property Query contains invalid value'

SPSiteDataQuery q = new SPSiteDataQuery();
q.ViewFields = "<FieldRef Name=\"Modified\"/>";
q.Lists = "<Lists ServerTemplate=\"101\"/>";
q.Webs = "<Webs Scope=\"SiteCollection\"/>";
q.Query = "<where><Geq><FieldRef Name='Modified' /><Value Type='DateTime'><Today OffsetDays='-1' /></Value></Geq></where>";

How do you do this ??

Limit to CAML Query Length ?

I have a dynamic CAML Query which runs Nested <Or> Statements. The Query works fine when there are Less than around 300 <Or>s but anything greater produces the "Value does not fall within the expected range" error. 

Multiple value checking in Caml Query.

    i would like to check the multiple values in caml. for example In operator in sql server . all helps are appreciate .

Another Issue with CAML Query



I know this question has to be put in Telerik Forums but its something related to CAML and data being bound programmatically. So, please take a minute to share your thoughts on my issue. Thanks.

In my previous post here , I had issue with CAML Query, which works great now. So, here is one of my issue related to it: I am using a Report which has Subreport. So, I have set the datasource of Main Report to be a DataTable that holds the CAML Query (the result CAML Query from previous post here ). Now, for the same parameter values, for each Report, I want its subsequent subreport to be be populate programmatically. But, this CAML Query do

CAML query help

I want to display last 6months data from custom list.how can I write the CAML  query for that one
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