Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi there,
I would like to creat an .ics file when creating my custom event node.
Is there plug in for this or an easy way of doing it?
cheers
mkariti
Did you find a solution?
Yes. was quite easy actually.
DateTime created = DateTime.Now;
DateTime start = DateTime.Parse(node.GetProperty("startTime").Value);
DateTime end = DateTime.Parse(node.GetProperty("endTime").Value);
DateTime lastModified = DateTime.Now;
string subject = ("" + node.Name).Replace("\n", "");
string body = ("" + node.Name).Replace("\n", "");
string addZ = string.Empty;
TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(timeZone);
start = TimeZoneInfo.ConvertTimeToUtc(start, timeZoneInfo);
end = TimeZoneInfo.ConvertTimeToUtc(end, timeZoneInfo);
addZ = "z";
string location = (node.GetProperty("location").Value).Replace("\n", "");
context.Response.AddHeader("content-disposition", "attachment;filename=" + node.Name + ".ics");
context.Response.Write("BEGIN:VCALENDAR" + Environment.NewLine);
context.Response.Write("VERSION:2.0" + Environment.NewLine);
context.Response.Write("PRODID:-//www.xxx.com" + Environment.NewLine);
context.Response.Write("METHOD:PUBLISH" + Environment.NewLine);
context.Response.Write("BEGIN:VTIMEZONE" + Environment.NewLine);
context.Response.Write(@"TZID:(GMT) Greenwich Mean Time ." + timeZone + @"\" + Environment.NewLine);
context.Response.Write("TZOFFSETFROM:+0000" + Environment.NewLine);
context.Response.Write("TZOFFSETTO:+0000" + Environment.NewLine);
context.Response.Write("END:VTIMEZONE" + Environment.NewLine);
context.Response.Write("BEGIN:VEVENT" + Environment.NewLine);
context.Response.Write("SUMMARY:" + subject + Environment.NewLine);
context.Response.Write("LOCATION:" + location + Environment.NewLine);
context.Response.Write("DTSTART:" + start.ToString("yyyyMMddTHHmm") + "00" + addZ + Environment.NewLine);
context.Response.Write("DTEND:" + end.ToString("yyyyMMddTHHmm") + "00" + addZ + Environment.NewLine);
context.Response.Write("CLASS:PUBLIC" + Environment.NewLine);
context.Response.Write("END:VEVENT" + Environment.NewLine);
context.Response.Write("END:VCALENDAR");
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
creating .ics files
Hi there,
I would like to creat an .ics file when creating my custom event node.
Is there plug in for this or an easy way of doing it?
cheers
mkariti
Did you find a solution?
Yes. was quite easy actually.
DateTime created = DateTime.Now;
DateTime start = DateTime.Parse(node.GetProperty("startTime").Value);
DateTime end = DateTime.Parse(node.GetProperty("endTime").Value);
DateTime lastModified = DateTime.Now;
string subject = ("" + node.Name).Replace("\n", "");
string body = ("" + node.Name).Replace("\n", "");
string addZ = string.Empty;
TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(timeZone);
start = TimeZoneInfo.ConvertTimeToUtc(start, timeZoneInfo);
end = TimeZoneInfo.ConvertTimeToUtc(end, timeZoneInfo);
addZ = "z";
string location = (node.GetProperty("location").Value).Replace("\n", "");
context.Response.AddHeader("content-disposition", "attachment;filename=" + node.Name + ".ics");
context.Response.Write("BEGIN:VCALENDAR" + Environment.NewLine);
context.Response.Write("VERSION:2.0" + Environment.NewLine);
context.Response.Write("PRODID:-//www.xxx.com" + Environment.NewLine);
context.Response.Write("METHOD:PUBLISH" + Environment.NewLine);
context.Response.Write("BEGIN:VTIMEZONE" + Environment.NewLine);
context.Response.Write(@"TZID:(GMT) Greenwich Mean Time ." + timeZone + @"\" + Environment.NewLine);
context.Response.Write("TZOFFSETFROM:+0000" + Environment.NewLine);
context.Response.Write("TZOFFSETTO:+0000" + Environment.NewLine);
context.Response.Write("END:VTIMEZONE" + Environment.NewLine);
context.Response.Write("BEGIN:VEVENT" + Environment.NewLine);
context.Response.Write("SUMMARY:" + subject + Environment.NewLine);
context.Response.Write("LOCATION:" + location + Environment.NewLine);
context.Response.Write("DTSTART:" + start.ToString("yyyyMMddTHHmm") + "00" + addZ + Environment.NewLine);
context.Response.Write("DTEND:" + end.ToString("yyyyMMddTHHmm") + "00" + addZ + Environment.NewLine);
context.Response.Write("CLASS:PUBLIC" + Environment.NewLine);
context.Response.Write("END:VEVENT" + Environment.NewLine);
context.Response.Write("END:VCALENDAR");
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.