thanks

On Wed, May 18, 2011 at 12:54 PM, Ishai Sagi <is...@exd.com.au> wrote:

> You do not use “[Today]” inside the value element, but as its own element.
>
> See my blogpost:
>
> http://www.sharepoint-tips.com/2009/06/using-today-token-in-caml-query.html
>
>
>
>
>
>
>
> *From:* ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] *On
> Behalf Of *Ajay
> *Sent:* Monday, 16 May 2011 2:19 PM
> *To:* ozMOSS
> *Subject:* Fwd: SharePoint 2007 - custom view filter issue
>
>
>
> Hi Guys,
>
> I have to created a custom view in code which will be filtered on Date is
> Equal/Greater than today's date.
>
> This is my query
> string dt = "[Today]"
> string query = "<Where><Geq><FieldRef Name=\"HolidayDate\"/>" +
>                 "<Value Type=\"DateTime\">" + dt +
> "</Value></Geq></Where>";
>
>
> This runs fine, and I can see the filter properly set up in the UI. But
> this does not work.
>
> It only works if I edit the view and just click Save without doing
> anything.
>
> string dt = "Today" , works but then it writes the filter value as today's
> date not as dynamic field.
>
> If I create a filter which is not based on dynamic value, that it works
> without problem.
> The dynamic [Today],  requires me to save it again and then Moss applies
> the filter
>
> Please advise
>
>
>
>
>
> Here is the complete code.
>
>
>         StringCollection viewFields = new StringCollection();
>             viewFields.Add("Title");
>             viewFields.Add("Date");
>
>             const string orderByColumn = "FileLeafRef";
>             string tName = "[Today]";
> //           string dateT =
> Microsoft.SharePoint.Utilities.SPUtility.CreateISO8601DateTimeFromSystemDateTime(DateTime.Today.AddDays(1));
>
>             string query = "<Where><Geq><FieldRef Name=\"Date\"/>" +
>                 "<Value Type=\"DateTime\">" + dateT +
> "</Value></Geq></Where>";
>
>
>             // here you can filter your items using the selected item in
> the dropdownlist
>                oViewCollection.Add(strViewName, viewFields, query, 100,
> true, isDefault);
>
>             oWeb.Update();
>             oList.Update();
>
>
>
> _______________________________________________
> ozmoss mailing list
> ozmoss@ozmoss.com
> http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
>
>
_______________________________________________
ozmoss mailing list
ozmoss@ozmoss.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss

Reply via email to