SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to creat a calender event that will be an all day event and will repeat every year from a list that has everyone's birthday. The recurrence works great and so does the All day event.

The problem is when I set newBirthDay["All Day Event"] = 1; the recurrence all of a sudden doesn't put the event in the correct day, but in the next day.

So say your birthday is on the 8th month and 3rd day, it will actually show up on the calender on August 4th and this only happens when I try to make it an All Day Event. If I leave it as normal it will show up on the correct day August 3rd. Anyone have any idea what could cause this? the C# code is included that handles it.

Thanks for looking

newBirthDay = calList.Add();

            newBirthDay["Title"] = "Happy Birthday, " + addBirthday["Title"].ToString();
            newBirthDay["Entry Type"] = "Birthday";

            string recurrence = "<recurrence><rule>" +
                                "<firstDayOfWeek>su</firstDayOfWeek>" +
                                "<repeat><yearly yearFrequency='1' month='" + addBirthday["Month"].ToString() + 
                                                                "' day='" + addBirthday["Day"].ToString() + "'/></repeat>" +
                                "<repeatForever>FALSE</repeatForever>" +

            newBirthDay["RecurrenceData"] = recurrence;
            newBirthDay["EventType"] = 1;
            newBirthDay["All Day Event"] = 1;
            newBirthDay["Recurrence"] = 1;
            newBirthDay["EventDate"] = new DateTime(DateTime.Now.Year, int.Parse(addBirthday["Month"].ToString()), int.Parse(addBirthday["Day"].ToString()));
            newBirthDay["EndDate"] = new DateTime(DateTime.Now.AddYears(100).Year, int.Parse(addBirthday["Month"].ToString()), int.Parse(addBirthday["Day"].ToString()));                
            newBirthDay["UID"] = System.Guid.NewGuid();
            newBirthDay["Description"] = "Happy Birthday, " + addBirthday["Name1"].ToString() + "\nbrithday = " + int.Parse(addBirthday["Day"].ToString()) + "|" + addBirthday["Day"].ToString();

share|improve this question

I had a colleague look at programmatically setting recurrence lately, I can't remember the details of his issue or how he resolved it but basically the "end time" for your events in the series should represent the end of the recurrence.

share|improve this answer
Thats not my issue, If you look at my EndDate I add 100 years to it so it'll repeat for 100 years. The only issue I have is when I enable All Day Event it puts it on the next day instead of the day set in EventDate in calendar view. – user1211 Aug 4 '10 at 12:21
up vote 0 down vote accepted

Apprently if you set it to an All Day Event it stores the date in UTC time so depending on your timezone it could end up looking like the next day.

Just set newBirthDay["TimeZone"]= -8;

and now it shows up on the correct day in my calendar for my timezone.

share|improve this answer

Your Answer


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