Attachments in the recurrent events

Hi,
I have 2 questions regarding recurrent event and modified occurences with attachments:

  1. For example I create master recurrent event with attachments in Outlook and then change some occurrences, EWS gives different IDs for same attachments in master and in modified occurrences, but actually attachments are belongs to master, so if I have master with 20mb attachments and 10 modified occurrences (without their own attachments) then I’ll download about 300MB that is not correct as, it’s actually 1 attachment that belongs to master event. How can I recognize such duplication in events (as id is different each modified occurrence and master). I’m pretty sure that exchange doesn’t duplicates it.

  2. Almost same question but when I create a PST with calendar and same master recurrent event with modified occurrences, how can I specify using your library that master has attachment and that this attachment will present in modified occurrences (as this normal Outlook / exchange behaviour - in the modified occurrences you still see master attachments) without attach this attachment to each modified occurrence, as this will dramatically increase PST size.

Thanks

@slavago,

I have observed the questions shared. We are looking in to questions and will get back to you with feedback as soon as possible. An issue with ID EMAILNET-39691 has been created in our issue tracking system as investigation so that we may share feedback with you as soon as it will be available.

@slavago,

Our team ha internally tried to investigate the issue and we request you to please provide the code snippet or test project which shows problems described in questions 1 and 2 above.

Hi,
For 1) I’m not using your library to retrieve, but EWS directly, and the code is scattered across number of files, so I can’t provide any sample here
For 2) Actually I wanted an sample from you that I’ll be able to attach attachment to master recurrent event and without adding it to each modified occurrence. As Microsoft does in Outlook.

Thanks

@slavago,

Thank you for sharing the feedback. We will investigate that and will get back to you if we may need further information in this regard.

Hi,
Can you please provide and example on how to add attachment to master recurrent event that it’ll be visible in modified occurences of that master ?
Thanks

Q1:
If you modify occurrences of recurrent event in the Outlook, even if you modify only the body and subject, in a modified occurrences a copy of the collection of master attachments is created in this occurrence. Such behavior increases the total size of the recurrent event. This is not the responsibility of Aspose.Email.

Aspose.Email implements a different logic. If you added an attachment to the master event, this attachment will be available in all occurrences, except for those in which you modifed (overloaded) the collection of attachments.

The code below demonstrates this logic. Here, the master attachment (common.txt) will be available in all occurrences except 1 in which your own attachment have been added.
If you want to see the master attachment (common.txt) in occurrence 1 , you should copy the master attachment to the attachment collection of this occurrence, but this will increase the overall recurrent event size.

            DateTime startDate = DateTime.Today.AddHours(12);
            var calendar = new MapiCalendar("location", "summary", "description", startDate, startDate.AddHours(1));

            calendar.Attachments.Add("common.txt", new byte[10000000]);

            MapiCalendarEventRecurrence recurrence = new MapiCalendarEventRecurrence();
            MapiCalendarRecurrencePattern pattern = recurrence.RecurrencePattern = new MapiCalendarDailyRecurrencePattern();
            pattern.PatternType = MapiCalendarRecurrencePatternType.Day;
            pattern.Period = 1;
            pattern.EndType = MapiCalendarRecurrenceEndType.EndAfterNOccurrences;
            pattern.OccurrenceCount = 10;

            for (int i = 1; i < 3; i++)
            {
                DateTime exceptionDate = startDate.AddDays(i);
                MapiCalendarExceptionInfo exception = new MapiCalendarExceptionInfo
                {
                    Location = "ch location " + i,
                    Subject = "ch summary " + i,
                    OriginalStartDate = exceptionDate,
                    StartDateTime = exceptionDate,
                    EndDateTime = exceptionDate.AddHours(5),
                    Attachments = new MapiAttachmentCollection()
                };
                if (i == 1)
                {
                    exception.Attachments.Add(i + ".txt", new byte[i]);
                }
                pattern.Exceptions.Add(exception);

                pattern.ModifiedInstanceDates.Add(exceptionDate);
                pattern.DeletedInstanceDates.Add(exceptionDate);
            }

            var exception4Date = startDate.AddDays(3);
            pattern.Exceptions.Add(new MapiCalendarExceptionInfo
            {
                Location = "ex location",
                Subject = "ex summary",
                Body = "ex body",
                OriginalStartDate = exception4Date,
                StartDateTime = exception4Date,
                EndDateTime = exception4Date.AddHours(5)
            });
            pattern.ModifiedInstanceDates.Add(exception4Date);
            pattern.DeletedInstanceDates.Add(exception4Date);
            calendar.Recurrence = recurrence;

            calendar.Save("cal.msg", AppointmentSaveFormat.Msg);


            using (var newPst = PersonalStorage.Create("calendar.pst", FileFormatVersion.Unicode))
            {
                var newFolder = newPst.CreatePredefinedFolder("Calendar", StandardIpmFolder.Appointments);
                newFolder.AddMapiMessageItem(calendar);
            }

I hope the shared elaboration will be helpful.