/* 
 * Copyright 2001-2013 Aspose Pty Ltd. All Rights Reserved.
 *
 * This file is part of Aspose.Email. The source code in this file
 * is only intended as a supplement to the documentation, and is provided
 * "as is", without warranty of any kind, either expressed or implied.
 */
 
package programmersguide.programmingemail.sendemailmessageswithsmtp.loadsaveappointmentinicsformat.java;

import com.aspose.email.*;
import java.util.Date;

public class LoadSaveAppointmentInICSFormat
{
    public static void main(String[] args) throws Exception
    {
        // The path to the documents directory.
        String dataDir = "src/programmersguide/programmingemail/sendemailmessageswithsmtp/loadsaveappointmentinicsformat/data/";

        // 1.
        // Create and save an Appointment to disk.

        // Create and initialize an instance of the Appointment class
        MailAddressCollection cColletion = new MailAddressCollection();//("attendees@domain.com");
        cColletion.add("attendees@domain.com");

        Appointment appointment = new Appointment(
                "Meeting Room 3 at Office Headquarters",
                "Monthly Meeting",
                "Please confirm your availability.",
                new Date(2011, 2, 8, 13, 0, 0),
                new Date(2011, 2, 8, 14, 0, 0),
                new MailAddress("from@domain.com"),
                cColletion);

        // Save the appointment to disk in ICS format
        appointment.save(dataDir + "test.ics", AppointmentSaveFormat.Ics);

        // Display Status.
        System.out.println("Appointment created and saved to disk successfully.");

        // 2.
        // Load an Appointment just created and saved to disk and display its details.

        // Load the appointment in ICS format
        Appointment loadedAppointment = Appointment.load(dataDir + "test.ics");

        // Display Status.
        System.out.println("\n\nLoaded Appointment details are as follows:");

        // Display the appointment information on screen
        System.out.println("Summary: " + loadedAppointment.getSummary());
        System.out.println("Location: " + loadedAppointment.getLocation());
        System.out.println("Description: " + loadedAppointment.getDescription());
        System.out.println("Start date: " + loadedAppointment.getStartDate());
        System.out.println("End date: " + loadedAppointment.getEndDate());
        System.out.println("Organizer: " + appointment.getOrganizer());
        System.out.println("Attendees: " + appointment.getAttendees());

        // Display Status.
        System.out.println("\nAppointment loaded and information displayed successfully.");
    }
}





@@ -1032,24 +1032,296 @@
 n.com%22);%0D%0A%0D%0A
+        java.util.Calendar cal = java.util.Calendar.getInstance();%0D%0A        cal.set(2011, 2, 8, 13, 0, 0);%0D%0A%0D%0A        java.util.Calendar cal1 = java.util.Calendar.getInstance();%0D%0A        cal1.set(2011, 2, 8, 14, 0, 0);%0D%0A%0D%0A        Date dateRepresentation = cal.getTime();%0D%0A
         Appo
@@ -1360,16 +1360,16 @@
 tment(%0D%0A
-
         
@@ -1528,86 +1528,53 @@
     
-new Date(2011, 2, 8, 13, 0, 0),%0D%0A                new Date(2011, 2, 8, 14, 0, 0
+cal.getTime(),%0D%0A                cal1.getTime(
 ),%0D%0A
@@ -1811,32 +1811,32 @@
 isplay Status.%0D%0A
-
         System.o
@@ -1901,24 +1901,26 @@
 ully.%22);%0D%0A%0D%0A
+%0D%0A
         // 2

Fix for deprecated Date usage