Hi,
Is there a way to modify a single instance of appointment out of a recurrence pattern, For example I have created a recurring appointment for every monday of a month, Now I want to change the timing and attendees of only the second monday appointment.
Please let us know if this is possible in Aspose Email for Java 19.1
There is already an old discussion present in the forum for this, but want to know if this has been added in later versions.
If this is possible, please provide a working sample code for doing this in Aspose Email for java for appointments.
Thanks
Kapil
@kapilgupta,
We have internally verified the requirements and still the support for modifying reassurances. One cannot change recurrences item using Appointment instance. MS Outlook also does not support EXRULE. MapiCalendar supported Exceptions and we can change the timing(not attendees) for one of recurrence. The following Java example is possible option using MapiCalendar.
public void test()
{
PersonalStorage pst = PersonalStorage.create("test.pst", FileFormatVersion.Unicode);
try
{
FolderInfo tmpFolder = pst.createPredefinedFolder("Calendar", StandardIpmFolder.Appointments);
Date startDate = newDate();
MapiCalendar calendar = new MapiCalendar("location", "summary", "description", startDate, addHours(startDate, 1));
// Daily Recurrence from Today for 10 days
MapiCalendarEventRecurrence recurrence = new MapiCalendarEventRecurrence();
recurrence.setRecurrencePattern(new MapiCalendarDailyRecurrencePattern());
MapiCalendarRecurrencePattern pattern = recurrence.getRecurrencePattern();
pattern.setPatternType(MapiCalendarRecurrencePatternType.Day);
pattern.setPeriod(1);
pattern.setEndType(MapiCalendarRecurrenceEndType.EndAfterNOccurrences);
pattern.setOccurrenceCount(10);
calendar.setRecurrence(recurrence);
// Modify Recurrence items
for (int i = 3; i < 6; i++)
{
Date exceptionDate = addDays(startDate, i);
MapiCalendarExceptionInfo exception = new MapiCalendarExceptionInfo();
exception.setLocation("new location" + i);
exception.setSubject("new summary" + i);
exception.setOriginalStartDate(exceptionDate);
exception.setStartDateTime(exceptionDate);
exception.setEndDateTime(addHours(exceptionDate, 5));
pattern.getExceptions().addItem(exception);
pattern.getModifiedInstanceDates().addItem(exceptionDate);
pattern.getDeletedInstanceDates().addItem(exceptionDate);
}
tmpFolder.addMapiMessageItem(calendar);
calendar.save("test.ics");
}
finally {
pst.dispose();
}
}
Date newDate() {
Calendar c = Calendar.getInstance();
c.set(Calendar.HOUR_OF_DAY, 0);
c.set(Calendar.MINUTE, 0);
c.set(Calendar.SECOND, 0);
c.set(Calendar.MILLISECOND, 0);
return c.getTime();
}
Date addHours(Date date, int count) {
Calendar c = Calendar.getInstance();
c.setTime(date);
c.add(Calendar.HOUR, count);
return c.getTime();
}
Date addDays(Date date, int count) {
Calendar c = Calendar.getInstance();
c.setTime(date);
c.add(Calendar.DATE, count);
return c.getTime();
}
Hi Mudassir,
Thanks for providing the code for modifying single instance of the meeting out of a recurrence pattern, However when I tested this code by generating this test.ics file and sending it over mail and then adding to the calendar, I observed that it is working correctly in the Outlook Windows Desktop Client but not working correctly in the Outlook Web Client, Nor does it works in the Gmail Calendar web client.
Please let us know how to achieve consistent behaviour in Desktop and web client.
Thanks
Kapil
@Kapil,
Can you please provide us the generated ICS file along with sample code (if modified) on your end. Please also provide the details of issue in terms of snapshot pointing difference between view in MS Outlook and Gmail or Outlook Web clients.
Here is the ICS file generated
using the above code, please note that I added a participant manually in the ICS file and then sent it as attachment to the same participant mail.
BEGIN:VCALENDAR
VERSION:2.0
METHOD:REQUEST
PRODID:-//Aspose Ltd//iCalendar Builder (v3.0)//EN
BEGIN:VEVENT
DTSTAMP:20190531T153758Z
DESCRIPTION:descriptionNEW
ORGANIZER;CN=kapil.gupta@abc.com:mailto:kapil.gupta@abc.com
ATTENDEE;ROLE=REQ-PARTICIPANT;CN=Sarthak:mailto:sarthak.garg@abc.com
ATTENDEE;ROLE=REQ-PARTICIPANT;CN=Yogesh:mailto:yogesh.kumar@abc.com
ATTENDEE;ROLE=REQ-PARTICIPANT;CN=Kapil:mailto:kapilgupta@abc.com
DTSTART:20190829T000000
DTEND:20190829T020000
EXDATE:20190901T000000
EXDATE:20190902T000000
EXDATE:20190903T000000
LOCATION:locationNEW
SEQUENCE:0
SUMMARY:summaryNEW
TRANSP:TRANSPARENT
X-MICROSOFT-CDO-BUSYSTATUS:FREE
UID:ae70b254-df49-42ad-91d2-4f213bdc3976
RRULE:FREQ=DAILY;INTERVAL=1;COUNT=10
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20190531T153759Z
RECURRENCE-ID:20190901T000000
SEQUENCE:0
DTSTART:20190901T000000
DTEND:20190901T060000
LOCATION:new location23
SUMMARY:new summary23
UID:ae70b254-df49-42ad-91d2-4f213bdc3976
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20190531T153759Z
RECURRENCE-ID:20190902T000000
SEQUENCE:0
DTSTART:20190902T000000
DTEND:20190902T060000
LOCATION:new location24
SUMMARY:new summary24
UID:ae70b254-df49-42ad-91d2-4f213bdc3976
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20190531T153759Z
RECURRENCE-ID:20190903T000000
SEQUENCE:0
DTSTART:20190903T000000
DTEND:20190903T060000
LOCATION:new location25
SUMMARY:new summary25
UID:ae70b254-df49-42ad-91d2-4f213bdc3976
END:VEVENT
END:VCALENDAR
Below is how it is shown the Gmail, it is not able to detect the recurrence in gmail. gmail.png (20.6 KB)
Below are images for the outlook web client, we can see that the for the outlook web client instead of changing time (adding 5 hours) for the occurrences on 1sep, 2 and 3sep, those meetings are deleted.
Outlook Web2019-05-31 15-48-14.png (3.5 KB)
OutLookWeb2 2019-05-31 15-49-37.png (6.3 KB)
In the outlook Desktop client, i had observed that for 1sep, 2 and 3sep, updated timings are shown
Thanks
Kapil
@kapilgupta,
I have observed the issue shared by you and have added an issue with ID EMAILJAVA-34545 has investigation in our issue tracking system. This thread has been linked with the issue so that you may be notified once the issue will be fixed.
Hi Mudassir,
If possible could you provide us the time it might take to fix this issue, we are dependent on this fix to be available for one of our deliverable.
Thanks
Kapil
@kapilgupta,
I have verified from our issue tracking system and like to share that issue has tentatively been marked for fixing in Aspose.Email for Java 19.6. We request for your patience and will share the good news with you as soon as the issue will be fixed.