internal EasSourceFolder(Add add, UserSmtpAddress userSmtpAddress) : base(add, userSmtpAddress) { }
internal byte[] CreateCalendarEvent(string clientId, string syncKey, out string newSyncKey, string folderId, Event theEvent, IList <Event> exceptionalEvents, IList <string> deletedOccurrences, UserSmtpAddress userSmtpAddress) { SyncRequest syncRequest = EasRequestGenerator.CreateSyncRequestForCreateCalendarEvent(syncKey, clientId, folderId, theEvent, exceptionalEvents, deletedOccurrences, userSmtpAddress); SyncResponse syncResponse = this.SyncCreation(clientId, syncRequest); newSyncKey = syncResponse.Collections[0].SyncKey; return(EasMailbox.GetEntryId(syncResponse.AddResponses[0].ServerId)); }
protected EasFolder(Add add, UserSmtpAddress userSmtpAddress) : base(add.ServerId, add.ParentId, add.DisplayName, add.GetEasFolderType()) { this.UserSmtpAddressString = (string)userSmtpAddress; }
private static Microsoft.Exchange.Connections.Eas.Model.Request.Calendar.Exception GetExceptionData(Event exceptionalEvent, bool isMeeting, ExDateTime masterStart, UserSmtpAddress userSmtpAddress) { Microsoft.Exchange.Connections.Eas.Model.Request.Calendar.Exception ex = new Microsoft.Exchange.Connections.Eas.Model.Request.Calendar.Exception(); ex.ExceptionStartTime = SyncCalendarUtils.GetExceptionStartDate(exceptionalEvent.Id, masterStart); SyncCalendarUtils.CopyCommonEventData(ex, exceptionalEvent, isMeeting, userSmtpAddress); return(ex); }
internal void UpdateCalendarEvent(string calendarEventId, string syncKey, string folderId, Event theEvent, IList <Event> exceptionalEvents, IList <string> deletedOccurrences, UserSmtpAddress userSmtpAddress) { SyncRequest syncRequest = EasRequestGenerator.CreateSyncRequestForUpdateCalendarEvent(syncKey, calendarEventId, folderId, theEvent, exceptionalEvents, deletedOccurrences, userSmtpAddress); this.SyncUpdate(calendarEventId, syncRequest); }
private static List <Microsoft.Exchange.Connections.Eas.Model.Request.Calendar.Attendee> GetAttendees(IList <Microsoft.Exchange.Entities.DataModel.Calendaring.Attendee> edmAttendees, UserSmtpAddress userSmtpAddress, ResponseStatus status) { List <Microsoft.Exchange.Connections.Eas.Model.Request.Calendar.Attendee> list = null; if (edmAttendees != null && edmAttendees.Count > 0) { list = new List <Microsoft.Exchange.Connections.Eas.Model.Request.Calendar.Attendee>(); foreach (Microsoft.Exchange.Entities.DataModel.Calendaring.Attendee attendee in edmAttendees) { Microsoft.Exchange.Connections.Eas.Model.Request.Calendar.Attendee attendee2 = new Microsoft.Exchange.Connections.Eas.Model.Request.Calendar.Attendee { AttendeeType = new byte?((byte)attendee.Type), Email = attendee.EmailAddress, Name = attendee.Name }; if (attendee.Status != null) { attendee2.AttendeeStatus = new byte?((byte)attendee.Status.Response); } else if (status != null && userSmtpAddress.Address.Equals(attendee.EmailAddress)) { attendee2.AttendeeStatus = new byte?((byte)status.Response); } list.Add(attendee2); } } return(list); }
public static void CopyCommonEventData(ICalendarData calendarData, Event theEvent, bool isMeeting, UserSmtpAddress userSmtpAddress) { EventSchema schema = theEvent.Schema; int num = (theEvent.PopupReminderSettings != null && theEvent.PopupReminderSettings.Count > 0) ? theEvent.PopupReminderSettings[0].ReminderMinutesBeforeStart : 0; if (theEvent.IsPropertySet(schema.BodyProperty) && theEvent.Body != null && theEvent.Body.Content != null) { calendarData.Body = new Body { Data = theEvent.Body.Content, Type = new byte?((byte)SyncCalendarUtils.GetEasBodyType(theEvent.Body.ContentType)) }; } if (theEvent.IsPropertySet(schema.StartProperty)) { calendarData.StartTime = SyncCalendarUtils.ToStringDateTime(theEvent.Start); } if (theEvent.IsPropertySet(schema.EndProperty)) { calendarData.EndTime = SyncCalendarUtils.ToStringDateTime(theEvent.End); } if (theEvent.IsPropertySet(schema.SubjectProperty)) { calendarData.CalendarSubject = theEvent.Subject; } if (theEvent.IsPropertySet(schema.LocationProperty)) { calendarData.Location = ((theEvent.Location != null) ? ((!string.IsNullOrEmpty(theEvent.Location.DisplayName)) ? theEvent.Location.DisplayName : null) : null); } if (theEvent.IsPropertySet(schema.PopupReminderSettingsProperty)) { calendarData.Reminder = ((num > 0) ? new uint?((uint)num) : null); } if (theEvent.IsPropertySet(schema.IsAllDayProperty)) { calendarData.AllDayEvent = new byte?(Convert.ToByte(theEvent.IsAllDay)); } if (theEvent.IsPropertySet(schema.ShowAsProperty)) { EasBusyStatus?busyStatus = SyncCalendarUtils.GetBusyStatus(theEvent.ShowAs); calendarData.BusyStatus = ((busyStatus != null) ? new byte?((byte)busyStatus.GetValueOrDefault()) : null); } if (theEvent.IsPropertySet(schema.SensitivityProperty)) { calendarData.Sensitivity = new byte?((byte)theEvent.Sensitivity); } if (theEvent.IsPropertySet(schema.LastModifiedTimeProperty)) { calendarData.DtStamp = SyncCalendarUtils.ToStringDateTime(theEvent.LastModifiedTime); } if (theEvent.IsPropertySet(schema.CategoriesProperty)) { calendarData.CalendarCategories = SyncCalendarUtils.GetCategories(theEvent.Categories); } if (isMeeting && theEvent.IsPropertySet(schema.AttendeesProperty)) { calendarData.Attendees = SyncCalendarUtils.GetAttendees(theEvent.Attendees, userSmtpAddress, theEvent.ResponseStatus); } }
public static List <Microsoft.Exchange.Connections.Eas.Model.Request.Calendar.Exception> GetExceptionData(IList <Event> exceptionalEvents, IList <string> deletedOccurrences, bool isMeeting, ExDateTime masterStart, UserSmtpAddress userSmtpAddress) { if (exceptionalEvents == null && deletedOccurrences == null) { return(null); } List <Microsoft.Exchange.Connections.Eas.Model.Request.Calendar.Exception> list = new List <Microsoft.Exchange.Connections.Eas.Model.Request.Calendar.Exception>(); if (exceptionalEvents != null) { foreach (Event exceptionalEvent in exceptionalEvents) { list.Add(SyncCalendarUtils.GetExceptionData(exceptionalEvent, isMeeting, masterStart, userSmtpAddress)); } } if (deletedOccurrences != null) { foreach (string deletedOccurrenceId in deletedOccurrences) { list.Add(SyncCalendarUtils.GetDeletedExceptionData(deletedOccurrenceId, masterStart)); } } return(list); }
public static ApplicationData ConvertEventToAppData(Event theEvent, IList <Event> exceptionalEvents, IList <string> deletedOccurrences, UserSmtpAddress userSmtpAddress) { ExTimeZone utcTimeZone; if (theEvent.IntendedStartTimeZoneId == "tzone://Microsoft/Utc" || theEvent.IntendedStartTimeZoneId == null) { utcTimeZone = ExTimeZone.UtcTimeZone; } else { ExTimeZoneEnumerator.Instance.TryGetTimeZoneByName(theEvent.IntendedStartTimeZoneId, out utcTimeZone); } bool flag = false; byte b = 0; if (theEvent.HasAttendees) { b |= 1; flag = true; } if (theEvent.IsCancelled) { b |= 4; } if (((IEventInternal)theEvent).IsReceived) { b |= 2; } ApplicationData applicationData = new ApplicationData(); SyncCalendarUtils.CopyCommonEventData(applicationData, theEvent, flag, userSmtpAddress); applicationData.TimeZone = ((utcTimeZone != null) ? SyncCalendarUtils.ToTimeZoneString(utcTimeZone) : null); applicationData.MeetingStatus = new byte?(b); applicationData.Uid = (string.IsNullOrEmpty(((IEventInternal)theEvent).GlobalObjectId) ? null : new GlobalObjectId(((IEventInternal)theEvent).GlobalObjectId).Uid); applicationData.Recurrence = SyncCalendarUtils.GetRecurrenceData(theEvent.PatternedRecurrence); applicationData.Exceptions = SyncCalendarUtils.GetExceptionData(exceptionalEvents, deletedOccurrences, flag, theEvent.Start, userSmtpAddress); if (flag) { applicationData.OrganizerEmail = theEvent.Organizer.EmailAddress; applicationData.OrganizerName = theEvent.Organizer.Name; applicationData.ResponseRequested = new byte?(Convert.ToByte(theEvent.ResponseRequested)); } return(applicationData); }
internal static SyncRequest CreateSyncRequestForUpdateCalendarEvent(string syncKey, string itemId, string folderId, Event theEvent, IList <Event> exceptionalEvents, IList <string> deletedOccurrences, UserSmtpAddress userSmtpAddress) { Microsoft.Exchange.Connections.Eas.Model.Request.AirSync.Collection collection = new Microsoft.Exchange.Connections.Eas.Model.Request.AirSync.Collection(); ChangeCommand changeCommand = new ChangeCommand(); changeCommand.ServerId = itemId; changeCommand.ApplicationData = SyncCalendarUtils.ConvertEventToAppData(theEvent, exceptionalEvents, deletedOccurrences, userSmtpAddress); collection.Commands.Add(changeCommand); collection.SyncKey = syncKey; collection.CollectionId = folderId; collection.GetChanges = new bool?(false); return(new SyncRequest { Collections = { collection } }); }