Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Is there a way to get the text displayed for the "Recurrence" field on the View Item screen for an OOB "Event" list item through the object model? For example, I see:

"Every 1 month(s) on the first Tuesday"

Is there maybe a calculated field that I can reference using an SPListItem to get at this string (ensuring it's localized correctly)? For example:

lblRecurrence.Text = item["RecurrenceText"].ToString();

Response targeted for SP2007, but interested if this carries over to 2010? Or if there is a way to get at it in 2010 that wasn't there before?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

So here is what I have come up with.

I created a simple console application to point at the "Event" list and loop through each of the SPListItems in it. For each SPListItem, I output the fields and values. I then looked through the document and I found nothing that resembled the "Recurrence Display Text". I also looked at the Schema.xml and confirmed there was nothing in there that looked similar to what I was looking for.

I started dissecting other pieces. Ultimately what I found where two controls:


I opened these up with Reflector and analyzed the internals.

RecurrenceDataControl appears to be strictly for EDITING recurrence data. Nice because this saves me from having to write this UI myself in my custom form. I can just instantiate an instance of this control and pass it a reference to the "RecurrenceData" xml (and give it references to item/list/web context).

RecurrenceField can be used for either EDITING or DISPLAYING of recurrence data. This is controlled by the ControlMode proeprty. The difference between RecurrenceField and RecurrenceDataControl for EDITING seems to be that RecurrenceDataControl only handles the xml portion of the recurrence data (the "RecurrenceData" field in the SPListItem), whereas the RecurrenceField control appears facilitate the checkbox/toggling functionality (and corresponds to the "fRecurrence" SPListItem field).

Simplified: RecurrenceField uses RecurrenceDataControl.

For getting at the textual representation, then, I can use the RecurrenceField control. The problem is, I need just the text, no markup. I don't actually want to let this render down myself (ultimately I am returning this text through a service layer). I am accomplishing this by the following:

    StringBuilder sb = new StringBuilder();
    StringWriter sw = new StringWriter(sb);
    HtmlTextWriter htw = new HtmlTextWriter(sw);

    RecurrenceField local = new RecurrenceField();
    local.ID = "testing1";
    local.ListId = List.ID;
    local.ItemId = Item.ID;
    local.FieldName = "fRecurrence";

    SPContext context = SPContext.GetContext(this.Context, Item.ID, List.ID, Web);
    local.ItemContext = context;
    //local.RenderContext = context;

    local.RenderControl(htw); //this is the KEY!

share|improve this answer
I forgot to mention, I tested the above with the English and Ukrainian language packs. The results I got were consistent with what was displaying in the Out of the Box (OOB) SharePoint DispForm.aspx. –  Brian Sep 14 '10 at 16:23
Also, forgot to mention that this appears to apply to both 2007 and 2010 versions of the product as the controls/classes used here are available (and not marked for deprecation) in either. –  Brian Sep 14 '10 at 16:24
I am having a similar requirement of needing to pull the display pattern for a recurring event. I have inherited a custom solution that sends and email once users create an event, to the existing notification I would like to add the pattern for recurring events. I am having trouble following your example, I am a newbie to sharepoint development. Thanks, Karen –  Karen Aug 21 at 22:12
Hi Karen. Apologies as I don't check back in here too often these days. I happened to maybe need this so I wen't searching for something I thought I had done around "friendly user display of recurrence items in SharePoint". As with many things in SharePoint, there are no public API's for getting at what you want/need, so you must get creative and try to "HACK" something together. This is a perfect example of that. All this is doing is using a SharePoint control and faking as if it were rendering on a web page. –  Brian Nov 10 at 16:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.