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
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss