ASP.NET - Integrating Appointment created in asp.net with outlook calendar

Asked By dinesh
01-Aug-11 01:28 AM
Hi friends,

       I have created an appointment screen where i am storing all the appointments created in a grid. My requirement now is to integrate those appointments with the outlook calendar. how to do this task.

With regards,
Dinesh
  TSN ... replied to dinesh
01-Aug-11 01:32 AM
hi..

Code It

To show how to create an ASP.NET Web site that has the ability to create and send an Internet Calendar appointment, this article walks through three key steps:

  1. Creating an ASP.NET 2.0 Web Site project in Visual Studio 2005.

  2. Creating a Web form for the site that lets a user specify a summary, description, and start or end dates and times for a calendar appointment.

  3. Adding code to the Web form's code file that implements the Internet Calendar appointment creation and sending functionality.

Creating an ASP.NET 2.0 Web Site Project in Visual Studio 2005

Visual Studio 2005 enables you to create a Web site by using the ASP.NET Web Site template.

To create an ASP.NET Web Site project in Visual Studio 2005

  1. Start Visual Studio.

  2. On the File menu, click New Web Site.

  3. In the New Web Site dialog box, click the ASP.NET Web Site template.

  4. For Location, select HTTP or File System.

  5. Specify a path or URL for the Web site.

  6. For Language, click Visual C# or Visual Basic, and then click OK.

    Visual Studio generates an ASP.NET Web Site project with a single Web form named Default.aspx, and a code file named either Default.aspx.cs or Default.aspx.vb, depending on the language selected.

Creating a Calendar Event Properties Web Form

By creating a Web form, a user can specify the properties of a calendar appointment, as shown in Figure 1.

To create a Calendar Event Web form

  • Open the Default.aspx file and replace all of the code between the <body> and </body> tags with the following code.

<form id="form1" runat="server">
  <div style="font-family: Arial" align="center">
    <table>
      <tr>
        <td align="left">
          Appointment Summary:</td>
      </tr>
      <tr>
        <td colspan="3">
          <asp:TextBox ID="txtEventSummary" runat="server" Width="98%"
          Rows="5"></asp:TextBox></td>
      </tr>
      <tr>
        <td align="left">
          Appointment Description:</td>
      </tr>
      <tr>
        <td colspan="3">
          <asp:TextBox ID="txtEventDescription" runat="server" Rows="5"
          Width="98%"></asp:TextBox></td>
      </tr>
      <tr>
        <td align="left">
          Starting Date/Time:</td>
        <td style="width: 30px" valign="top"></td>
        <td align="left" valign="top">Ending Date/Time:</td>
      </tr>
      <tr>
        <td>
          <asp:DropDownList ID="ddlStartTime" runat="server"
          Width="49%">
            <asp:ListItem Value="000000">12:00 AM</asp:ListItem>
            <asp:ListItem Value="003000">12:30 AM</asp:ListItem>
            <asp:ListItem Value="010000">1:00 AM</asp:ListItem>
            <asp:ListItem Value="013000">1:30 AM</asp:ListItem>
            <asp:ListItem Value="020000">2:00 AM</asp:ListItem>
            <asp:ListItem Value="023000">2:30 AM</asp:ListItem>
            <asp:ListItem Value="030000">3:00 AM</asp:ListItem>
            <asp:ListItem Value="033000">3:30 AM</asp:ListItem>
            <asp:ListItem Value="040000">4:00 AM</asp:ListItem>
            <asp:ListItem Value="043000">4:30 AM</asp:ListItem>
            <asp:ListItem Value="050000">5:00 AM</asp:ListItem>
            <asp:ListItem Value="053000">5:30 AM</asp:ListItem>
            <asp:ListItem Value="060000">6:00 AM</asp:ListItem>
            <asp:ListItem Value="063000">6:30 AM</asp:ListItem>
            <asp:ListItem Value="070000">7:00 AM</asp:ListItem>
            <asp:ListItem Value="073000">7:30 AM</asp:ListItem>
            <asp:ListItem Value="080000">8:00 AM</asp:ListItem>
            <asp:ListItem Value="083000">8:30 AM</asp:ListItem>
            <asp:ListItem Value="090000">9:00 AM</asp:ListItem>
            <asp:ListItem Value="093000">9:30 AM</asp:ListItem>
            <asp:ListItem Value="100000">10:00 AM</asp:ListItem>
            <asp:ListItem Value="103000">10:30 AM</asp:ListItem>
            <asp:ListItem Value="110000">11:00 AM</asp:ListItem>
            <asp:ListItem Value="113000">11:30 AM</asp:ListItem>
            <asp:ListItem Value="120000">12:00 PM</asp:ListItem>
            <asp:ListItem Value="123000">12:30 PM</asp:ListItem>
            <asp:ListItem Value="130000">1:00 PM</asp:ListItem>
            <asp:ListItem Value="133000">1:30 PM</asp:ListItem>
            <asp:ListItem Value="140000">2:00 PM</asp:ListItem>
            <asp:ListItem Value="143000">2:30 PM</asp:ListItem>
            <asp:ListItem Value="150000">3:00 PM</asp:ListItem>
            <asp:ListItem Value="153000">3:30 PM</asp:ListItem>
            <asp:ListItem Value="160000">4:00 PM</asp:ListItem>
            <asp:ListItem Value="163000">4:30 PM</asp:ListItem>
            <asp:ListItem Value="170000">5:00 PM</asp:ListItem>
            <asp:ListItem Value="173000">5:30 PM</asp:ListItem>
            <asp:ListItem Value="180000">6:00 PM</asp:ListItem>
            <asp:ListItem Value="183000">6:30 PM</asp:ListItem>
            <asp:ListItem Value="190000">7:00 PM</asp:ListItem>
            <asp:ListItem Value="193000">7;30 PM</asp:ListItem>
            <asp:ListItem Value="200000">8:00 PM</asp:ListItem>
            <asp:ListItem Value="203000">8:30 PM</asp:ListItem>
            <asp:ListItem Value="210000">9:00 PM</asp:ListItem>
            <asp:ListItem Value="213000">9:30 PM</asp:ListItem>
            <asp:ListItem Value="220000">10:00 PM</asp:ListItem>
            <asp:ListItem Value="223000">10:30 PM</asp:ListItem>
            <asp:ListItem Value="230000">11:00 PM</asp:ListItem>
            <asp:ListItem Value="233000">11:30 PM</asp:ListItem>

          </asp:DropDownList><asp:DropDownList ID="ddlStartTZ"
          runat="server" Width="50%">
            <asp:ListItem>US/Eastern</asp:ListItem>
            <asp:ListItem>US/Central</asp:ListItem>
            <asp:ListItem>US/Mountain</asp:ListItem>
            <asp:ListItem>US/Pacific</asp:ListItem>
          </asp:DropDownList></td>
        <td style="width: 30px" valign="top"></td>
        <td valign="top">
          <asp:DropDownList ID="ddlEndTime" runat="server" Width="49%">
            <asp:ListItem Value="000000">12:00 AM</asp:ListItem>
            <asp:ListItem Value="003000">12:30 AM</asp:ListItem>
            <asp:ListItem Value="010000">1:00 AM</asp:ListItem>
            <asp:ListItem Value="013000">1:30 AM</asp:ListItem>
            <asp:ListItem Value="020000">2:00 AM</asp:ListItem>
            <asp:ListItem Value="023000">2:30 AM</asp:ListItem>
            <asp:ListItem Value="030000">3:00 AM</asp:ListItem>
            <asp:ListItem Value="033000">3:30 AM</asp:ListItem>
            <asp:ListItem Value="040000">4:00 AM</asp:ListItem>
            <asp:ListItem Value="043000">4:30 AM</asp:ListItem>
            <asp:ListItem Value="050000">5:00 AM</asp:ListItem>
            <asp:ListItem Value="053000">5:30 AM</asp:ListItem>
            <asp:ListItem Value="060000">6:00 AM</asp:ListItem>
            <asp:ListItem Value="063000">6:30 AM</asp:ListItem>
            <asp:ListItem Value="070000">7:00 AM</asp:ListItem>
            <asp:ListItem Value="073000">7:30 AM</asp:ListItem>
            <asp:ListItem Value="080000">8:00 AM</asp:ListItem>
            <asp:ListItem Value="083000">8:30 AM</asp:ListItem>
            <asp:ListItem Value="090000">9:00 AM</asp:ListItem>
            <asp:ListItem Value="093000">9:30 AM</asp:ListItem>
            <asp:ListItem Value="100000">10:00 AM</asp:ListItem>
            <asp:ListItem Value="103000">10:30 AM</asp:ListItem>
            <asp:ListItem Value="110000">11:00 AM</asp:ListItem>
            <asp:ListItem Value="113000">11:30 AM</asp:ListItem>
            <asp:ListItem Value="120000">12:00 PM</asp:ListItem>
            <asp:ListItem Value="123000">12:30 PM</asp:ListItem>
            <asp:ListItem Value="130000">1:00 PM</asp:ListItem>
            <asp:ListItem Value="133000">1:30 PM</asp:ListItem>
            <asp:ListItem Value="140000">2:00 PM</asp:ListItem>
            <asp:ListItem Value="143000">2:30 PM</asp:ListItem>
            <asp:ListItem Value="150000">3:00 PM</asp:ListItem>
            <asp:ListItem Value="153000">3:30 PM</asp:ListItem>
            <asp:ListItem Value="160000">4:00 PM</asp:ListItem>
            <asp:ListItem Value="163000">4:30 PM</asp:ListItem>
            <asp:ListItem Value="170000">5:00 PM</asp:ListItem>
            <asp:ListItem Value="173000">5:30 PM</asp:ListItem>
            <asp:ListItem Value="180000">6:00 PM</asp:ListItem>
            <asp:ListItem Value="183000">6:30 PM</asp:ListItem>
            <asp:ListItem Value="190000">7:00 PM</asp:ListItem>
            <asp:ListItem Value="193000">7;30 PM</asp:ListItem>
            <asp:ListItem Value="200000">8:00 PM</asp:ListItem>
            <asp:ListItem Value="203000">8:30 PM</asp:ListItem>
            <asp:ListItem Value="210000">9:00 PM</asp:ListItem>
            <asp:ListItem Value="213000">9:30 PM</asp:ListItem>
            <asp:ListItem Value="220000">10:00 PM</asp:ListItem>
            <asp:ListItem Value="223000">10:30 PM</asp:ListItem>
            <asp:ListItem Value="230000">11:00 PM</asp:ListItem>
            <asp:ListItem Value="233000">11:30 PM</asp:ListItem>
          
          </asp:DropDownList><asp:DropDownList ID="ddlEndTZ"
          runat="server" Width="50%">
            <asp:ListItem>US/Eastern</asp:ListItem>
            <asp:ListItem>US/Central</asp:ListItem>
            <asp:ListItem>US/Mountain</asp:ListItem>
            <asp:ListItem>US/Pacific</asp:ListItem>
          </asp:DropDownList></td>
      </tr>
      <tr>
        <td>
          <asp:Calendar ID="calStartDate" runat="server"
          BackColor="White" BorderColor="Black" BorderStyle="Solid"
          CellSpacing="1" Font-Names="Verdana" Font-Size="9pt"
          ForeColor="Black" Height="250px" NextPrevFormat="ShortMonth">
            <SelectedDayStyle BackColor="333399" ForeColor="White" />
            <TodayDayStyle BackColor="999999" ForeColor="White" />
            <DayStyle BackColor="CCCCCC" />
            <OtherMonthDayStyle ForeColor="999999" />
            <NextPrevStyle Font-Bold="True" Font-Size="8pt" 
            ForeColor="White" />
            <DayHeaderStyle Font-Bold="True" Font-Size="8pt" 
            ForeColor="333333" Height="8pt" />
            <TitleStyle BackColor="333399" BorderStyle="Solid"
            Font-Bold="True" Font-Size="12pt"
            ForeColor="White" Height="12pt" />
          </asp:Calendar>
        </td>
        <td style="width: 30px" valign="top"></td>
        <td valign="top">
          <asp:Calendar ID="calEndDate" runat="server"
          BackColor="White" BorderColor="Black" BorderStyle="Solid" 
          CellSpacing="1" Font-Names="Verdana" Font-Size="9pt" 
          ForeColor="Black" Height="250px" NextPrevFormat="ShortMonth">
            <SelectedDayStyle BackColor="333399" ForeColor="White" />
            <TodayDayStyle BackColor="999999" ForeColor="White" />
            <DayStyle BackColor="CCCCCC" />
            <OtherMonthDayStyle ForeColor="999999" />
            <NextPrevStyle Font-Bold="True" Font-Size="8pt"
            ForeColor="White" />
            <DayHeaderStyle Font-Bold="True" Font-Size="8pt"
            ForeColor="333333" Height="8pt" />
            <TitleStyle BackColor="333399" BorderStyle="Solid"
            Font-Bold="True" Font-Size="12pt"
            ForeColor="White" Height="12pt" />
          </asp:Calendar>
        </td>
      </tr>
      <tr>
        <td align="center" colspan="3" valign="top">
          <asp:Button ID="btnAddEvent" runat="server" 
          OnClick="btnAddEvent_Click" Text="Add Event" /></td>
      </tr>
    </table>
  </div>
</form>



Figure 1. Calendar Event Properties Web Form

Add Calendar Event Web Form

for more reference..
http://msdn.microsoft.com/en-us/library/bb655909%28v=office.12%29.aspx
  James H replied to dinesh
01-Aug-11 01:33 AM

You can create an ICS file that the user can double click and store the appointment. If multiple users, it can be sent to others. If you can get access to their exchange server (sounds like you can't), as SLaks asked, you can use something like this (http://goo.gl/G2nrd). If you have no access to Exchange directly, the ICS file format will allow the user to add the appointment.

If you want an example of an ics file (other than a Google search), sign up for a Microsoft event and click the "add to outlook" button. The fortunate thing about this methodology is it can also work with other mail/calendar applications that use the format.

http://www.codeproject.com/KB/aspnet/teamcalendar.aspx

  Ravi S replied to dinesh
01-Aug-11 01:35 AM
HI

try this

http://www.aspnetemail.com/help/aspnetemail.calendaring.icalendar.html
static void Main()
            {
                //new iCalendar
                iCalendar ic = LoadCalendar(); 
             
                //load the EmailMessage from the web.config or app.config  file
                EmailMessage m = new EmailMessage( true, false );
                m.Subject = "Appointment";
             
                m.AddCalendar( ic );
             
                m.Send();
            }
             
            public static iCalendar LoadCalendar() 
            {
                iCalendar  ic = new iCalendar();            
             
                //create the organizer
                ic.Event.Organizer.FullName = "Doe, J. MR";
                ic.Event.Organizer.Email = "john@example.com";
             
                //set the timezone
                ic.TimeZone.TimeZoneIndex = TimeZoneHelper.EasternTimeUSAndCanadaGMTm0500;
             
                //define the event
                ic.Event.Summary.Text = "Meeting Request";
                ic.Event.Description.Text = "This meeting request is to discuss the design specs of the project.";
             
                ic.Event.Location.Text = "Conf rm 100. Building 20, Main Campus";
                ic.Event.DateStart.Date = new DateTime(2004, 10, 21, 14, 0, 0);
                ic.Event.DateEnd.Date = new DateTime(2004, 10, 21, 15, 0, 0);            
             
                //mark the time as busy (not available to free-busy searches).
                ic.Event.TimeTransparency.TransparencyType = TransparencyType.Opaque;
             
                //set this a high priority event
                ic.Event.Priority.PriorityType  = PriorityType.High; 
             
                //make the event private
                ic.Event.Classification.ClassificationType = ClassificationType.Private;
             
                ic.Event.Categories.Add( CategoryType.MEETING );
             
                //Add the Attendee
                Attendee att1 = new Attendee( );
                att1.FullName = "Dave Jones";
                att1.Email = "dave@example.com";
                att1.ParticipationStatus = ParticipationStatus.NEEDSACTION;
                att1.Role = RoleType.REQ_PARTICIPANT;            
                att1.RSVP = true;
                ic.Event.Attendees.Add( att1 );
             
                //set an alarm
                Alarm a = new DisplayAlarm( "This is a reminder of the upcoming specs meeting." );
                // repeat the alarm for 10 times (snooze)
                a.Repeat.Count = 10;
             
                // triggers 30 minutes before the event starts            
                a.Trigger.RelativeTrigger.Negative = true;
                a.Trigger.RelativeTrigger.TimeSpan = new TimeSpan( 0, 30, 0 );
             
                // delay period after which the alarm will repeat
                a.DelayPeriod.TimeSpan = new TimeSpan( 0, 10, 0 );            
                    
                ic.Event.Alarms.Add( a );
             
                
                return ic;
            }
  Vickey F replied to dinesh
01-Aug-11 01:36 AM

I think what you're looking for is an .ics attachment for email. This requires you to create specifically crafted text file with an .ics extension and attach that to your email.

A quick google for "asp.net ics" brings up: http://www.codeproject.com/KB/applications/SendAppointment.aspx which seems suitable to your needs.http://en.wikipedia.org/wiki/ICalendar also has a link on this.

Stackoverflow also has this tag that has more information: http://stackoverflow.com/questions/tagged/icalendar

  Vickey F replied to dinesh
01-Aug-11 01:36 AM

I think what you're looking for is an .ics attachment for email. This requires you to create specifically crafted text file with an .ics extension and attach that to your email.

A quick google for "asp.net ics" brings up: http://www.codeproject.com/KB/applications/SendAppointment.aspx which seems suitable to your needs.http://en.wikipedia.org/wiki/ICalendar also has a link on this.

Stackoverflow also has this tag that has more information: http://stackoverflow.com/questions/tagged/icalendar

  Vickey F replied to dinesh
01-Aug-11 01:37 AM

The iCalender class supports both vCal and iCal format. From a specification format, iCalendar has 2 versions. According to the internet standards, vCal is commonly referred to as iCalendar version 1.0. iCal, is commonly referred to as iCalender v2.0.

More information on the RFCs can be found at:

  • http://www.ietf.org/rfc/rfc2445.txt?number=2445, Internet Calendaring and Scheduling Core Object Specification (iCalendar)
  • http://www.ietf.org/rfc/rfc2446.txt, iCalendar Transport-Independent Interoperability Protocol (iTIP): Scheduling Events, BusyTime, To-dos and Journal Entries
  • http://www.ietf.org/rfc/rfc2447.txt, iCalendar Message-based Interoperability Protocol (iMIP)

Use this code-

static void Main()
            {
                //new iCalendar
                iCalendar ic = LoadCalendar(); 
             
                //load the EmailMessage from the web.config or app.config  file
                EmailMessage m = new EmailMessage( true, false );
                m.Subject = "Appointment";
             
                m.AddCalendar( ic );
             
                m.Send();
            }
             
            public static iCalendar LoadCalendar() 
            {
                iCalendar  ic = new iCalendar();            
             
                //create the organizer
                ic.Event.Organizer.FullName = "Doe, J. MR";
                ic.Event.Organizer.Email = "john@example.com";
             
                //set the timezone
                ic.TimeZone.TimeZoneIndex = TimeZoneHelper.EasternTimeUSAndCanadaGMTm0500;
             
                //define the event
                ic.Event.Summary.Text = "Meeting Request";
                ic.Event.Description.Text = "This meeting request is to discuss the design specs of the project.";
             
                ic.Event.Location.Text = "Conf rm 100. Building 20, Main Campus";
                ic.Event.DateStart.Date = new DateTime(2004, 10, 21, 14, 0, 0);
                ic.Event.DateEnd.Date = new DateTime(2004, 10, 21, 15, 0, 0);            
             
                //mark the time as busy (not available to free-busy searches).
                ic.Event.TimeTransparency.TransparencyType = TransparencyType.Opaque;
             
                //set this a high priority event
                ic.Event.Priority.PriorityType  = PriorityType.High; 
             
                //make the event private
                ic.Event.Classification.ClassificationType = ClassificationType.Private;
             
                ic.Event.Categories.Add( CategoryType.MEETING );
             
                //Add the Attendee
                Attendee att1 = new Attendee( );
                att1.FullName = "Dave Jones";
                att1.Email = "dave@example.com";
                att1.ParticipationStatus = ParticipationStatus.NEEDSACTION;
                att1.Role = RoleType.REQ_PARTICIPANT;            
                att1.RSVP = true;
                ic.Event.Attendees.Add( att1 );
             
                //set an alarm
                Alarm a = new DisplayAlarm( "This is a reminder of the upcoming specs meeting." );
                // repeat the alarm for 10 times (snooze)
                a.Repeat.Count = 10;
             
                // triggers 30 minutes before the event starts            
                a.Trigger.RelativeTrigger.Negative = true;
                a.Trigger.RelativeTrigger.TimeSpan = new TimeSpan( 0, 30, 0 );
             
                // delay period after which the alarm will repeat
                a.DelayPeriod.TimeSpan = new TimeSpan( 0, 10, 0 );            
                    
                ic.Event.Alarms.Add( a );
             
                
                return ic;
            }
  Reena Jain replied to dinesh
01-Aug-11 02:11 AM
Hi,

Well,You can create an ICS file that the user can double click and store the appointment. If multiple users, it can be sent to others. If you can get access to their exchange server (sounds like you can't), as SLaks asked, you can use something like this (http://goo.gl/G2nrd). If you have no access to Exchange directly, the ICS file format will allow the user to add the appointment.

If you want an example of an ics file (other than a Google search), sign up for a Microsoft event and click the "add to outlook" button. The fortunate thing about this methodology is it can also work with other mail/calendar applications that use the format.

Hope this will help you

Create New Account
help
Net hi friends Any one send frequently asked Important questions in C# .Net, ADO .Net, Asp .Net and Sql Server. . . . . . . . tx in Advance. . . . . . Hi, Find this. . (B)What is an IL? (B A) What is scavenging? (B) What are different types of caching using cache object of ASP.NET? (B) How can you cache different version of same page using ASP.NET cache object? (A) How will implement Page Fragment Caching? (B) Can you compare ASP.NET sessions with classic ASP? (B) Which are the various modes of storing ASP.NET session
Microsoft.Jet.OLEDB.4.0;”+ _ “Data Source = C: \ Documents and Settings \ User \ My Documents \ Visual Studio Projects \ 1209 \ db1.mdb”+ _ “User ID = Admin;”+ _ “Password = ;”); Dim cmd As New OleDbCommand in Sql server as var_name int How do you separate business logic while creating an ASP.NET application? There are two level of asp.net debugging 1. Page level debugging For this we have to edit the page level debugging the corresponding date and time written Steps are:- Creating a CalenderControl 1) To begin, open Visual Studio .NET and begin a new C# Windows Control Library. 2) You may name it whatever
Migration from ASP to ASP.net How to convert ASP site to ASP.NET site using C# http: / / www.asp.net / downloads / archived-v11 / migration-assistants / asp-to-aspnet hi, ASP.NET framework is very much different from unstrucured ASP and there is no correct way to
Tracing in ASP.NET? hi all, what is tracing? how to achieve tracing in asp.net? different ways of doing tracing? thanks and regards Aman Khan hi. . Tracing in ASP.NET 2.0 Tracing is a way to monitor the execution of your ASP.NET application. You can record exception details and program flow in a way that doesn't