Microsoft Office Outlook cannot import vCalendar file. This error can appear if you have attempted to save a recurring Lunar appointment in iCalendar format. To avoid this error, set the appointment option to Gregorian instead of Lunar.
Can anyone help me get this Export to ICS working? it works on Teleriks site - what am I doing wrong I'm going nuts and will be a big hero once this works right! lol
20 Answers, 1 is accepted
We have received reports for the first error already ("Error parsing..."), but we still cannot reproduce it locally. Have you modified the example when running it on your machine? Any additional details you can provide about the browser/operating system and regional settings you are using will also help us diagnose the problem.
Regarding the Outlook error - does it happen with the file generated from our site? Can you quote the generated file here. What version of Outlook are you using?
Regards,
Tsvetomir Tsonev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center

Okay the sys.webforms parsing error happens whether I preview it in VS 2005 using the internal (Cerini) web server, or if I push it up to my win2k dev web server running IIS. To answer your question, it works perfect when I view the demo on your site - and even the generated Outlook .ICS file imports into my Outlook 2003. So I know this can be made to work!! lol Also I've even tried using my same code - but stripped out the extra stuff/formatting/DHTML menus, etc.... and while the Javascript error I am having goes away, the sys.webforms error persists.
Here is my ASPX and VB Code Behind - hopefully something I'm doing wrong will jump out at you guys. Thanks for your help.
ASPX Page - note the crazy javascript is for my rollovers and DHTML menus I have on the page.... the way I am calling the ASP:Scheduler should be just like the Telerik sample more or less.
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="calendar.aspx.vb" Inherits="marketing_calendar" StylesheetTheme="Main" Theme="Main" EnableEventValidation="False" %> |
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" |
Namespace="System.Web.UI" TagPrefix="asp" %> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml"> |
<head id="Head1" runat="server" > |
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server" > |
<script type="text/javascript"> |
function Export(sender, e) |
{ |
$find("<%= RadAjaxManager1.ClientID %>").__doPostBack(sender.name, ""); |
} |
</script> |
</telerik:RadCodeBlock> |
<title>Marketing</title> |
<style type="text/css"> |
input.blue {background-color: #3a66a5; font-weight: bold; font-size: 12px; color: white;} |
input.plum {background-color: #342430; font-weight: bold; font-size: 12px; color: white;} |
.style1 { |
text-align: center; |
} |
</style> |
<script type="text/javascript"> |
<!-- |
function FP_swapImg() {//v1.0 |
var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length; |
n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm; |
elm.$src=elm.src; elm.src=args[n+1]; } } |
} |
function FP_preloadImgs() {//v1.0 |
var d=document,a=arguments; if(!d.FP_imgs) d.FP_imgs=new Array(); |
for(var i=0; i<a.length; i++) { d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; } |
} |
function FP_getObjectByID(id,o) {//v1.0 |
var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id); |
else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el; |
if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c) |
for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; } |
f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements; |
for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } } |
return null; |
} |
function FP_swapImgRestore() {//v1.0 |
var doc=document,i; if(doc.$imgSwaps) { for(i=0;i<doc.$imgSwaps.length;i++) { |
var elm=doc.$imgSwaps[i]; if(elm) { elmelm.src=elm.$src; elm.$src=null; } } |
doc.$imgSwaps=null; } |
} |
// --> |
</script> |
</head> |
<body style="background-color:#cccccc; background-image:url(/images/main-bg.jpg); background-repeat:repeat-x" onload="FP_preloadImgs(/*url*/'/images/attorneysonly_on.gif',/*url*/'/images/partneronly_on.gif',/*url*/'/images/qlinks_marketing_on.gif')"> |
<div id="dmbri" style="position:absolute;"> |
<img src="/images/dmb_i.gif" name="dmbif" width="1" height="1" alt=""> |
<img src="/images/dmb_m.gif" name="dmbjs" width="1" height="1" alt=""> |
</div> |
<script language="javascript" type="text/javascript"> |
var rimPath=null;var rjsPath=null;var rPath2Root=null;function InitRelCode(){var iImg;var jImg;var tObj;if(!document.layers){iImg=document.images['dmbif'];jImg=document.images['dmbjs'];tObj=jImg;}else{tObj=document.layers['dmbri'];if(tObj){iImg=tObj.document.images['dmbif'];jImg=tObj.document.images['dmbjs'];}}if(!tObj){window.setTimeout("InitRelCode()",700);return false;}rimPath=_gp(iImg.src);rjsPath=_gp(jImg.src);rPath2Root=rjsPath+"../";return true;}function _purl(u){return xrep(xrep(u,"%%REP%%",rPath2Root),"\\","/");}function _fip(img){if(img.src.indexOf("%%REL%%")!=-1) img.src=rimPath+img.src.split("%%REL%%")[1];return img.src;}function _gp(p){return p.substr(0,p.lastIndexOf("/")+1);}function xrep(s,f,n){if(s) ss=s.split(f).join(n);return s;}InitRelCode(); |
</script> |
<script language="javascript" type="text/javascript"> |
function LoadMenus() {if(!rjsPath){window.setTimeout("LoadMenus()", 10);return false;}var navVer = navigator.appVersion; |
if(navVer.substr(0,3) >= 4) |
if((navigator.appName=="Netscape") && (parseInt(navigator.appVersion)==4)) { |
document.write('<' + 'script language="javascript" type="text/javascript" src="' + rjsPath + 'nsmenu.js"><\/script\>'); |
} else { |
document.write('<' + 'script language="javascript" type="text/javascript" src="' + rjsPath + 'iemenu.js"><\/script\>'); |
}return true;}LoadMenus();</script> |
<!-- DHTML Menu Builder Loader Code END --> |
<form id="form1" method="post" runat="server"> |
<asp:ScriptManager ID="ScriptManager1" runat="server"> |
</asp:ScriptManager> |
<!-- Begin Container --> |
<div id="container"> |
<!-- Begin Masthead --> |
<div id="Masthead"> |
<table border="0" cellspacing="0" cellpadding="0"> |
<tr> |
<td rowspan="2" align="left" valign="top"> |
<img id="Img1" src="/images/hp_banner_left.gif" alt="" runat="server" /></td> |
<td valign="top" align="right"> |
<asp:Panel ID="SearchPanel" runat="server" DefaultButton="submit"> |
<!-- Search Code --> |
<input id="target" name="target" type="text" /><asp:Button ID="submit" runat="server" |
CssClass="plum" PostBackUrl="/search/ISSearch.asp" Text="Search" /> |
<input style="display: none" type="text" /> |
<!-- end Search Code --> |
</asp:Panel> |
</td> |
</tr><tr valign="bottom"> |
<td align="right" valign="bottom"> |
<asp:PlaceHolder ID="PlaceHolder1" runat="server" Visible="false"><a href="/secure/partners/partners.aspx" ><img src="/images/secure_partnerOFF.jpg" alt="" style="border-style:none;" id="img2" onmouseout="FP_swapImgRestore()" onmouseover="FP_swapImg(1,1,/*id*/'img1',/*url*/'/images/secure_partnerON.jpg')" /></a></asp:PlaceHolder><asp:PlaceHolder ID="PlaceHolder2" runat="server" Visible="false"><a href="/secure/attorneys/attorneys.aspx"><img src="/images/secure_attyOFF.jpg" alt="" style="border-style:none;" id="img3" onmouseout="FP_swapImgRestore()" onmouseover="FP_swapImg(1,1,/*id*/'img2',/*url*/'/images/secure_attyON.jpg')" /></a></asp:PlaceHolder></td></tr><tr><td colspan="2"><img id="Img4" src="/images/hp_banner3.jpg" alt="" runat="server" /></td></tr> |
</table> |
</div> |
<!-- End Masthead --> |
<!-- Begin Navigation --> |
<div id="navigation"> |
<img src="/images/1pixspacerTRANSPARENT.gif" height="20" alt="" /> |
</div> |
<!-- End Navigation --> |
<!-- Begin Page Content --> |
<div id="page_content"> |
<!-- Begin Left Column --> |
<div id="column_l" style="left: 0px; width: 720px; top: 0px;"> |
<!-- #BeginEditable "content" --> |
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="RadScheduler1"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManager> |
<div style="margin:0.3em 0"> |
<asp:ImageButton runat="server" ID="Button2" ImageUrl="/images/exportButton.gif" AlternateText="Export All to iCalendar" |
OnClientClick="Export(this, event); return false;" OnClick="Button2_Click" /> |
</div> |
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Transparency="30" |
BackColor="#E0E0E0" InitialDelayTime="500" > |
<asp:Image ID="Image1" Style="margin-top: 200px" runat="server" ImageUrl="/images/loading.gif" |
BorderWidth="0px" AlternateText="Loading"></asp:Image> |
</telerik:RadAjaxLoadingPanel> |
<telerik:RadScheduler runat="server" ID="RadScheduler1" Width="730px" Skin="Default" |
EnableEmbeddedSkins="True" TimeZoneOffset="03:00:00" DayStartTime="08:00:00" DayEndTime="18:00:00" DataSourceID="Events_Sqldatasource" |
DataKeyField="ID" DataSubjectField="subject" DataStartField="start_time" DataEndField="end_time" |
DataRecurrenceField="recurrenceRule" DataRecurrenceParentKeyField="recurrenceParentID" |
OnAppointmentCommand="RadScheduler1_AppointmentCommand"> |
<ResourceTypes> |
<telerik:ResourceType DataSourceID="EventsTypeName_sqldatasource" ForeignKeyField="EventTypeID" |
KeyField="EventTypeID" Name="Event Types" TextField="EventTypeName" /> |
</ResourceTypes> |
<AppointmentTemplate> |
<%# Eval("Subject") %> |
<div style="text-align: right;"> |
<span style="cursor: pointer; cursor: hand;"> |
<asp:ImageButton runat="server" ID="Button1" ImageUrl="/images/Outlook.gif" AlternateText="Export to iCalendar" |
CommandName="Export" OnClientClick="Export(this, event); return false;" /> |
</span> |
</div> |
</AppointmentTemplate> |
</telerik:RadScheduler> |
<asp:SqlDataSource ID="EventsTypeName_sqldatasource" runat="server" ConnectionString="<%$ ConnectionStrings:IntranetDBConnectionString %>" |
SelectCommand="SELECT [EventTypeID], [EventTypeName] FROM [EventTypes]"></asp:SqlDataSource> |
<asp:SqlDataSource ID="Events_Sqldatasource" runat="server" ConnectionString="<%$ ConnectionStrings:IntranetDBConnectionString %>" |
DeleteCommand="DELETE FROM [Events] WHERE [ID] =@ID" InsertCommand="INSERT INTO [Events] ([subject],[start_time],[end_time],[roomID],[userID],[recurrenceRule],[recurrenceParentID]) VALUES (@subject, @start_time, @end_time, @roomID, @userID, @recurrenceRule, @recurrenceParentID)" |
SelectCommand="SELECT [EventTypeID], [ID], [subject], [start_time], [end_time], [roomID], [userID], [recurrenceRule], [recurrenceParentID] FROM [Events]" |
UpdateCommand="UPDATE [Events] SET [subject] = @subject, [start_time] = @start_time, [EventTypeID] = @EventTypeID, [end_time] =@end_time, [roomID] = @roomID, [userID] = @userID, [recurrenceRule] = @recurrenceRule, [recurrenceParentID] = @recurrenceParentID WHERE (ID = @ID)"> |
<DeleteParameters> |
<asp:Parameter Name="ID" /> |
</DeleteParameters> |
<UpdateParameters> |
<asp:Parameter Name="subject" /> |
<asp:Parameter Name="start_time" /> |
<asp:Parameter Name="end_time" /> |
<asp:Parameter Name="roomID" /> |
<asp:Parameter Name="userID" /> |
<asp:Parameter Name="recurrenceRule" /> |
<asp:Parameter Name="recurrenceParentID" /> |
<asp:Parameter Name="ID" /> |
<asp:Parameter Name="EventTypeID" /> |
</UpdateParameters> |
<InsertParameters> |
<asp:Parameter Name="subject" /> |
<asp:Parameter Name="start_time" /> |
<asp:Parameter Name="end_time" /> |
<asp:Parameter Name="roomID" /> |
<asp:Parameter Name="userID" /> |
<asp:Parameter Name="recurrenceRule" /> |
<asp:Parameter Name="recurrenceParentID" /> |
</InsertParameters> |
</asp:SqlDataSource> |
<!-- #EndEditable --> |
</div> |
<!-- End Left Column --> |
</div> |
<!-- End Page Content --> |
<!-- Begin Footer --> |
<div id="footer"> |
<p>Copyright © 2007 Downey Brand LLP. All Rights Reserved.</p> |
</div> |
<!-- End Footer --> |
</div> |
<!-- End Container --> |
</form> |
</body> |
</html> |
And here is the VB Code Behind page
Imports System |
Imports System.Web.UI |
Imports Telerik.Web.UI |
Partial Public Class marketing_calendar |
Inherits System.Web.UI.Page |
Private Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) |
End Sub |
Protected Sub RadScheduler1_AppointmentCommand(ByVal sender As Object, ByVal e As AppointmentCommandEventArgs) Handles RadScheduler1.AppointmentCommand |
If e.CommandName = "Export" Then |
WriteCalendar(RadScheduler.ExportToICalendar(e.Container.Appointment)) |
End If |
End Sub |
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As ImageClickEventArgs) |
WriteCalendar(RadScheduler.ExportToICalendar(RadScheduler1.Appointments)) |
End Sub |
Private Sub WriteCalendar(ByVal data As String) |
Dim response As HttpResponse = Page.Response |
response.Clear() |
response.Buffer = True |
response.ContentType = "text/calendar" |
response.ContentEncoding = Encoding.UTF8 |
response.Charset = "utf-8" |
response.AddHeader("Content-Disposition", "attachment;filename=""RadSchedulerExport.ics""") |
response.Write(data) |
response.End() |
End Sub |
End Class |
I think we have found the problem - one of your buttons is named "submit" and due to the specifics of the JavaScript form object it messes up the form.submit() method. JavaScript can be too dynamic at times, but the workaround is easy enough - rename your button to "submitButton" or something different.
Regards,
Tsvetomir Tsonev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center

Trevor Gipson
Asst. Network / Web Administrator
Downey Brand, LLP
Sacramento, CA

I acknowledge this shortcoming in the current version. The problem is that in the exported file the time is marked as UTC, otherwise it is unchanged. When you import this data it gets converted to local time, hence the difference.
We have addressed the issue in the upcoming Service Pack by adding two new overloads to the RadScheduler.Export method. They take a TimeSpan as a parameter and add it to the appointment.
For example, you will be able to use:
TimeSpan currentOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now); |
string iCal = RadScheduler.Export(apt, currentOffset); |
The service pack is due in a few days.
Kind regards,
Tsvetomir Tsonev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center

public void ProcessRequest(HttpContext context) |
{ |
HttpResponse response = context.Response; |
HttpRequest request = context.Request; |
response.BufferOutput = true; |
response.ContentType = "text/calendar"; |
response.AddHeader("Content-disposition", "attachment; filename=appointment.vcs"); |
response.Cache.SetCacheability(HttpCacheability.NoCache); |
//your appointment id |
int ID = Convert.ToInt32(request.QueryString["ID"]); |
//your method to query the database and write your own output |
writeEntry(EventID, response.Output); |
response.End(); |
} |
output.WriteLine("BEGIN:VCALENDAR"); |
output.WriteLine("VERSION:2.0"); |
output.WriteLine("PRODID:" + url); |
output.WriteLine("METHOD:PUBLISH"); |
output.WriteLine("BEGIN:VEVENT"); |
output.WriteLine("UID:" + Guid.NewGuid().ToString()); |
output.WriteLine("DTSTAMP:" + DateTime.Now.ToUniversalTime().ToString("yyyyMMddTHHmmss") + "Z"); |
output.WriteLine("CATEGORIES:APPOINTMENT;PERSONAL"); |
output.WriteLine(EncodeProperty("DESCRIPTION;ENCODING=QUOTED-PRINTABLE:", description)); |
output.WriteLine("DTEND:" + endtime.ToUniversalTime().ToString("yyyyMMddTHHmmss") + "Z"); |
if (!(location == null)) |
{ |
output.WriteLine(EncodeProperty("LOCATION;ENCODING=QUOTED-PRINTABLE:", location)); |
} |
output.WriteLine("PRIORITY:0"); |
output.WriteLine("DTSTART:" + starttime.ToUniversalTime().ToString("yyyyMMddTHHmmss") + "Z"); |
output.WriteLine("STATUS:NEEDS ACTION"); |
output.WriteLine(EncodeProperty("SUMMARY;ENCODING=QUOTED-PRINTABLE:", title)); |
output.WriteLine("URL:" + url); |
output.WriteLine("END:VEVENT"); |
output.WriteLine("END:VCALENDAR"); |

Protected Sub RadScheduler1_AppointmentCommand(ByVal sender As Object, ByVal e As AppointmentCommandEventArgs)
Dim currentOffset
currentOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now)
If e.CommandName = "Export" Then
WriteCalendar(RadScheduler.ExportToICalendar(e.Container.Appointment, currentOffset))
End If
End Sub
Could you please be more specific what exactly happens when you use this code? Do you get a compilation error or is the export output not correct? Also, do you use the latest version of RadScheduler from the service pack we released Wednesday, this week?
Kind regards,
Peter
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center

We replied in the other forum thread about this issue. Here is the answer:
"True, the time frame of the appointments is off when exported. It looks like we have missed one small detail - the currentOffset argument should be passed with a "-" sign.
WriteCalendar(RadScheduler.ExportToICalendar(e.Container.Appointment, -currentOffset))"
Kind regards,
Peter
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center

Okay... Here is my latest stab at getting this to work. This time I am using the '-' currentOffset and I still have a werid Export time. Outlook opens up and say's a 1pm-2pm on 11/14/07 appt is a 9pm-10pm appt on 11/13/07!!! now what.... here's my code.
Protected Sub RadScheduler1_AppointmentCommand(ByVal sender As Object, ByVal e As AppointmentCommandEventArgs) Handles RadScheduler1.AppointmentCommand
Dim currentOffSet As TimeSpan = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now)
Dim iCal As String = RadScheduler.ExportToICalendar(e.Container.Appointment, -currentOffSet)
If e.CommandName = "Export" Then
WriteCalendar(iCal)
End If
End Sub
Please, ignore the last suggestion. We are sorry for misleading you, the time zone offset should be passed in without a minus sign.
The real problem turned to be a bug in our code. I am attaching a trial hotfix here.
Best wishes,
Tsvetomir Tsonev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center

TimeSpan currentOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now);
WriteCalendar(RadScheduler.ExportToICalendar(e.Container.Appointment,currentOffset));
However, my appointments are still showing up as one hour later. Is there something that has changed in Q3 to make the exports work correctly for exports?
This might be a result of Daylight Saving Time changes. If the appointment is created before the DST transition, it will be off by one hour. We can take the time zone offset for the date when the appointment is created to correct this:
DateTime aptStart = DateTime.SpecifyKind(e.Container.Appointment.Start, DateTimeKind.Local); |
TimeSpan currentOffset = TimeZone.CurrentTimeZone.GetUtcOffset(aptStart); |
WriteCalendar(RadScheduler.ExportToICalendar(e.Container.Appointment, currentOffset)); |
Let us know how it goes.
Sincerely yours,
Tsvetomir Tsonev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.


Thanks!
How exactly do you implement this case? Can you open a support ticket and send us a workind demo project of the problem?
Regards,
Peter
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.

Protected Sub RadScheduler1_AppointmentCommand(ByVal sender As Object, ByVal e As AppointmentCommandEventArgs) |
If e.CommandName = "Export" Then |
Dim aptStart As DateTimeDateTime = DateTime.SpecifyKind(e.Container.Appointment.Start, DateTimeKind.Local) |
Dim currentOffset As TimeSpan = TimeZone.CurrentTimeZone.GetUtcOffset(aptStart) |
WriteCalendar(RadScheduler.ExportToICalendar(e.Container.Appointment, currentOffset)) |
End If |
End Sub |

I am using Outlook 2003. The Export link works great from your demo site.