Recurring Tasks

Feb 18, 2009 at 12:43 AM

I'm playing around with task recurrences and would love to see some examples of the data you can pass into the RecurrenceConverter.GetRecurrence method. Or some docco would be good :)

Also, do you have an approach for getting recurrence data OUT of a task once you've put it in there? ie. I see the recurrence converter as a tool for creating a repeat string from your recurrence input data. But I can't see how I can easily look at the Recurrence for a task and know that it happens (say) every Wednesday without having to do some string parsing and essentially write logic that does the reverse of the RecurrenceConverter.GetRecurrence method.

Feb 18, 2009 at 1:00 AM

What you can pass to the RecurrenceConverter.GetRecurrence is what the RTM API sends back, which itself is an implementation of RFC2445, which you can find here: (look for 4.3.10, Recurrence Rule).
The IronCow implementation was adapted from a C implementation sent to me by some nice guy.
Not all cases are supported by the RecurrenceConverter, however, since RTM itself doesn't support everything.

I never had a situation where I needed to parse a natural language recurrence string ("every other monday") since whatever the user types is going to be sent to RTM, and they're going to do that parsing when it's submitted as part of the "setRecurrence" API function. I just needed the other way (turn the Recurrence structure into a user-friendly natural string) to display it.
I don't see why you would need to do the parsing yourself?
Feb 18, 2009 at 1:10 AM
Thanks for your reply and the pointer to the RFC. I'll check it out.

The reason I want to parse myself is for use in an application that synchronises tasks between Outlook and RTM. I want to convert the RTM recurrence string to an Outlook recurrence programatically.

It could be that Outlook implements the RFC in some way shape or form so it's something I can investigate.
Feb 18, 2009 at 3:31 PM
If you need access to the structured Recurrence info, you could use the RestClient directly and get the RawTaskSeries which will have that string in it (and which is later passed into the RecurrenceConverter). We could also expose it on the Task (right now only the user friendly version is exposed).
Feb 19, 2009 at 4:33 AM
For the time being (because I thought it was simpler as I'm not using the RestClient directly at all), I've written a couple of regular expressions that can parse the user friendly info coming out of the RecurrenceConverter and change it back into the non-user-friendly form. This seems to be doing the trick. But I will look into using the RestClient as it will make my code much easier to read - the regular expressions are a bit confusing. Thanks.