This question is locked. New answers and comments are not allowed.
Hi sir,
i need pass the RecurrencePattern from SchedlerView to sharepoint RecurrenceData field
the problem is :
1) i ll get RecurrencePattern from rad SchedlerView ll be in string format ie "FREQ=DAILY;UNTIL=20111216T040000Z;INTERVAL=2;BYDAY=SU,MO,TU,WE,TH,FR,SA" i need to convert to xml to store it in sharepoint RecurrenceData field
2)sharepoint RecurrenceData field takes only xml ie
//"<recurrence>
// <rule>
// <firstDayOfWeek>
// su
// </firstDayOfWeek>
// <repeat>
// <weekly su='TRUE' mo='TRUE' tu='TRUE' weekFrequency='1' />
// </repeat>
// <repeatForever>FALSE"
// </repeatForever>
// </rule>
// </recurrence>";
how to convert this xml into RecurrencePattern string ie (" FREQ=DAILY;UNTIL=20111216T040000Z;INTERVAL=2;BYDAY=SU,MO,TU,WE,TH,FR,SA" ) and (vis versa) is there any way i can do it ?
now i am doing this manual like this only for " WEEKLY" Recurrence
plz help me.
thank u
Tamkeen
i need pass the RecurrencePattern from SchedlerView to sharepoint RecurrenceData field
the problem is :
1) i ll get RecurrencePattern from rad SchedlerView ll be in string format ie "FREQ=DAILY;UNTIL=20111216T040000Z;INTERVAL=2;BYDAY=SU,MO,TU,WE,TH,FR,SA" i need to convert to xml to store it in sharepoint RecurrenceData field
2)sharepoint RecurrenceData field takes only xml ie
//"<recurrence>
// <rule>
// <firstDayOfWeek>
// su
// </firstDayOfWeek>
// <repeat>
// <weekly su='TRUE' mo='TRUE' tu='TRUE' weekFrequency='1' />
// </repeat>
// <repeatForever>FALSE"
// </repeatForever>
// </rule>
// </recurrence>";
how to convert this xml into RecurrencePattern string ie (" FREQ=DAILY;UNTIL=20111216T040000Z;INTERVAL=2;BYDAY=SU,MO,TU,WE,TH,FR,SA" ) and (vis versa) is there any way i can do it ?
now i am doing this manual like this only for " WEEKLY" Recurrence
var serializedPattern = RecurrencePatternHelper.RecurrencePatternToString(e.Appointment.RecurrenceRule.Pattern); XDocument doc = new XDocument(); XElement recurrence = new XElement("recurrence"); XElement rule = new XElement("rule"); recurrence.Add(rule); XElement repeat = new XElement("repeat"); // xelements of the weekly XElement weekly = null; XElement DAILY = null; XElement MONTHL = null; XElement UNTIL = null; string[] value1 = serializedPattern.Split(';'); foreach (string str in value1) { if (str == "FREQ=WEEKLY") { rule.Add(repeat); weekly = new XElement("weekly"); repeat.Add (weekly); } else if (str == "FREQ=DAILY") { rule.Add(repeat); DAILY = new XElement("DAILY"); repeat.Add(DAILY); } else if (str == "FREQ=MONTHL") { rule.Add(repeat); MONTHL = new XElement("MONTHL"); repeat.Add(MONTHL); } string mystr = str.Substring(0, 5); if (mystr == "COUNT") { } else if (mystr == "UNTIL") { StringBuilder dataformate = new StringBuilder(); dataformate.Append(str.Substring(6, 16)); dataformate.Insert(4, "-"); dataformate.Insert(7, "-"); dataformate.Insert(13, ":"); dataformate.Insert(16, ":"); UNTIL = new XElement("windowEnd", dataformate); rule.Add(UNTIL); } else if (mystr == "INTER") { weekly.Add(new XAttribute("weekFrequency", "1")); } else if (mystr == "WKST=") { } else if (mystr == "BYDAY") { string day = str.Substring(6); string[] days = day.Split(','); foreach (string strin in days) { if (value1[0].ToString() == "FREQ=WEEKLY") { if (strin == "SU") { weekly.Add(new XAttribute("su", "TRUE")); } else if (strin == "MO") { weekly.Add(new XAttribute("mo", "TRUE")); } else if (strin == "TU") { weekly.Add(new XAttribute("tu", "TRUE")); } else if (strin == "WE") { weekly.Add(new XAttribute("we", "TRUE")); } else if (strin == "TH") { weekly.Add(new XAttribute("th", "TRUE")); } else if (strin == "FR") { weekly.Add(new XAttribute("fr", "TRUE")); } else if (strin == "SA") { weekly.Add(new XAttribute("sa", "TRUE")); } } else if (value1[0].ToString() == "FREQ=WEEKLY") { if (strin == "SU") { weekly.Add(new XAttribute("su", "TRUE")); } else if (strin == "MO") { weekly.Add(new XAttribute("mo", "TRUE")); } else if (strin == "TU") { weekly.Add(new XAttribute("tu", "TRUE")); } else if (strin == "WE") { weekly.Add(new XAttribute("we", "TRUE")); } else if (strin == "TH") { weekly.Add(new XAttribute("th", "TRUE")); } else if (strin == "FR") { weekly.Add(new XAttribute("fr", "TRUE")); } else if (strin == "SA") { weekly.Add(new XAttribute("sa", "TRUE")); } } } } } doc.Add(recurrence); }plz help me.
thank u
Tamkeen