Gunnar Peipman's ASP.NET blog

ASP.NET, C#, SharePoint, SQL Server and general software development topics.

Sponsors

News

 
 
 
 
 
Programming Blogs - Blog Catalog Blog Directory

Links

Social

Filtering SharePoint calendar by Start Time

I had a problem when trying to filter WSS 3.0 calendar list by Start Time column. This column doesn't appear in filtered columns list somewhy. I found solution that smells like dirty hack to me, but at least it solved my problem. Oooh, this SharePoint is sometimes so kinky.... I'm almost sur ethere is better way to do that but if you are in hurry and need a working hack then here we go!

So, let's go step by step:

  • Open Calendar list settings.
  • Add new column called (by example) Begin.
  • Choose "Calculated" as a type of new column.
  • In the Formula field insert the following formula:
    =[Start Time]
  • Select Date and Time as data type of new column.
  • Clear check from "Add to default view" checkbox.
  • Save the new column.

Now you should be able to use the column called Begin instead of Start Date when you need to filter calendar list.

Posted: Oct 09 2007, 12:39 PM by DigiMortal | with 23 comment(s)
Filed under:

Comments

Mike Fairley said:

Yeah - ain't that weird.  Why does SharePoint have these annoying litle idiosyncrasies.  Nice work around though.

# October 29, 2007 11:25 PM

Yair said:

This doesn't work when you expand recurring events.

Yair

# April 21, 2008 5:46 AM

chris said:

This workaround worked great - I am starting to develop a love/hate relationship with Sharepoint though.

# May 29, 2008 7:35 AM

DigiMortal said:

It seems to me that you can do many things using Web Parts because you can use API and CAML. Laying purely on SharePoint browser based environment is not usually enough.

# May 30, 2008 1:49 AM

Vin said:

Any idea how to overcome the issue with recurring event?

# June 1, 2008 9:55 AM

Sonnekki said:

To correctly deal with recurring events, make sure that your filters are correct; get the "Begin" column from both sides:

Say you want a window from today to 30 days in the future.

Here's what the filter would look like:

Begin is Less Than Or Equal To [Today]+30

AND

Begin is Greater Than Or Equal To [Today]

# August 4, 2008 10:35 AM

Jason said:

When using recurring events the start date defaults to the day the event was set to start. While the "Start Time" column displays the different dates as they progress, if you do the calculated field on "Start Time" it will only return the start time of the entire recurring event. So if you told the recurring event to start on 8/1/08, the Start Time may show 8/5/08 (today) but the calculated column will still show 8/1/08 regardless. I don't see how filters would fix this.

# August 5, 2008 4:02 PM

Fred said:

Yeah,,,what Jason said.

Desperately seeking solution.  

Shame on MS for this one!

# August 20, 2008 2:41 PM

Steven said:

To filter a calendar with recurring events:

Open Calendar list settings.

Add new column called (by example) End.

Choose "Calculated" as a type of new column.

In the Formula field insert the following formula:

=[End Time]

Select Date as data type of new column.

Clear check from "Add to default view" checkbox.

Save the new column.

When filtering the view,

Select the 'End' column

Select "is greater than or equal to" option

Type: [Today]

Explanation:

All events have an end date associated with it.  So, if the recurring event has a recurring date set for a future date, then that event will continually show until the end date of the occurance has past the current date.  There is no reason to create the 'Start' column for this example.

# August 29, 2008 1:03 PM

Leon Bryant said:

There is aslo weirdness in the "All Day Event" function. The calcualated fields do not work correctly. any thoughts?

# October 6, 2008 6:36 PM

Gabe said:

Steven,

Your method should work. Unfortunately something in the RecurrenceData of the events does not always allow this to function properly.

For example when I tried your method, most of my recurrences appeared fine. one recurring event appeared 3 times, then one recurrence did not. the two recurrences appearing in the filter had the EndCalculation = EndTime (Date Only). The last recurrence which was not showing had EndCalculation = 10/15/2085. I have had other end dates of 10/31/2012 and 2099. This happened with 3 other recurrence series which also had bad End Times.

It sounds crazy but Sharepoint is randomly instatiating wrong End dates into the RecurrenceData XML.

# October 30, 2008 10:13 AM

DK said:

Hi

Does anyone have a solution yet for the recurrence issue?

# November 3, 2008 8:03 AM

Federico Modolo said:

The solution mentioned above, won't resolve the problem exposed. If you analize further, you'll be able to notice that in sharepoint the recurrence dates are only shown (in allitems view), but they are not really stored as an array of dates (this is my opinion). I believe this is the reason why the date field is not available for filtering. The real value for this field is only the initial recurrence date (in start date) end the final recurrence date in (end date). I really believe it is required a patch from microsoft for this problem to be solved. If someone has a solution, is welcome! Thank you all.

# February 9, 2009 4:43 AM

Maleware said:

When I try to Save the new column. I get this error message ...

"The formula contains reference(s) to field(s). "

Any ideas gratefully received!

# February 16, 2009 10:18 AM

dab0816 said:

Still having the same recurrence issue

# February 26, 2009 8:55 AM

murali said:

its urgent pls any body have code/url pls send me

my mail id murali525@gmail.com

# March 3, 2009 4:36 AM

Tim said:

I don't have a solution to this problem, but I can attest to how korky SharePoint is...

I have a view setup to filter by a keyword in the description field for calendar events (which are recurring).  If I add criteria to filter by End Date, using AND operator, I actually get some items that did not show up when only filtering by description field.  Makes no sense.  

For you logic buffs, I'm starting with a set A, filtering off items (by description) to get a sub-set B; then filtering B (by date) to get set C.  Therefore C should logically be a sub-set of B, but what I'm saying is that it is NOT, which is very alarming, and MS really needs to do something about SharePoint's disparities. It's wasting my time and I'm sure many others.

# March 26, 2009 4:45 PM

Tim said:

I may have figured something out here:  

When creating the view, choose "Standard View, with expanded recurring events"

This will list each instance of a recurring event, from 'today' on.  If you only want the first 10 items starting today, just set the 'limit' to 10.  

I've tried this out, and it seems to be working.

# March 26, 2009 5:35 PM

Brian said:

Seems like since the time you enter in the event is linked to a date.  Even though you're not putting in a date.  

MS should have fixed this by having "Date", "Time", and "Date Time".

you could create a cloumn "Time" and have the dropdown have a list of times they can choose from.  The problem lies in showing recurring items from today on.

sorry i added nothing to this.

# April 7, 2009 3:12 PM

Kirsten said:

Hey Tim,

Thank you very much!  You suggestion does most of what I was wanting to achieve:

I wanted a view of just the events occuring in the next 2 weeks and to not show "All Day Events" which ended yesterday (they get calculated as "Ending" the day after the last "All Day").  This Almost does it:

 1. Copy "Start Date" to "Starting" and "End Date" to "Ending" fields

 2. Create a "Standard View, with expanded recurring events"

 3. Filter the view for:

All Dave Event = Yes

AND

Ending > [Today]

OR

All Dave Event = No

AND

Ending >= [Today]

 4. Limit items to 5

Remaining issues:

 - the "Starting" date of recurring events remains the date the recurrance was created

 - Is a view of the next 5 events, not the next 2 weeks of events.

I hope this helps someone!

This will list each instance of a recurring event, from 'today' on.  If you only want the first 10 items starting today, just set the 'limit' to 10.

# April 14, 2009 9:20 PM

Kelly said:

WSS v 3.0 does not allow you to filter using Today/Me etc

Has anyone found an alternitive that works on WSS v3.0?

# May 13, 2009 8:47 PM

cris said:

can be possible to compare in workflow two date/time data type  (where one is calculated )

Action such as

If duedate> create

Condition

send email

# June 11, 2009 10:55 PM

cris said:

can be possible to compare in workflow two date/time data type  (where one is calculated )

Action such as

If duedate> create

Condition

send email

# June 11, 2009 11:13 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)