private static string GetExceptionStartDate(string exceptionId, ExDateTime masterStart) { StoreObjectId storeObjectId = IdConverter.Instance.ToStoreObjectId(exceptionId); OccurrenceStoreObjectId occurrenceStoreObjectId = storeObjectId as OccurrenceStoreObjectId; if (occurrenceStoreObjectId == null) { throw new EasSyncFailedPermanentException("Exception id is not an occurrence id: " + exceptionId); } return(SyncCalendarUtils.ToStringDateTime(occurrenceStoreObjectId.OccurrenceId.Add(masterStart.UniversalTime.TimeOfDay))); }
private void CopyListToDictionary(IList <SyncCalendarItemType> items, string listName, Dictionary <ISyncItemId, ServerManifestEntry> newServerManifest) { AirSyncDiagnostics.TraceInfo <string, int>(ExTraceGlobals.RequestsTracer, this, "{0}:{1}", listName, items.Count); foreach (SyncCalendarItemType syncCalendarItemType in items) { EntitySyncWatermark watermark = null; object obj; if (syncCalendarItemType.RowData != null && syncCalendarItemType.RowData.TryGetValue(ItemSchema.ArticleId, out obj) && !(obj is PropertyError)) { watermark = EntitySyncWatermark.CreateWithChangeNumber((int)obj); } ISyncItemId syncItemId = EntitySyncItemId.CreateFromId(syncCalendarItemType.ItemId); ServerManifestEntry serverManifestEntry = new ServerManifestEntry(ChangeType.Add, syncItemId, watermark); serverManifestEntry.MessageClass = "IPM.APPOINTMENT"; serverManifestEntry.CalendarItemType = syncCalendarItemType.CalendarItemType; OccurrenceStoreObjectId occurrenceStoreObjectId = StoreId.GetStoreObjectId(syncCalendarItemType.ItemId) as OccurrenceStoreObjectId; if (occurrenceStoreObjectId != null) { serverManifestEntry.SeriesMasterId = occurrenceStoreObjectId.GetMasterStoreObjectId(); } newServerManifest.Add(syncItemId, serverManifestEntry); } }
private Event GetCalendarEventData(Activity activity, out IList <Event> exceptionalOccurrences, out IList <string> deletedOccurrences) { exceptionalOccurrences = null; deletedOccurrences = null; Event result; try { StoreObjectId storeObjectId = activity.ItemId; OccurrenceStoreObjectId occurrenceStoreObjectId = storeObjectId as OccurrenceStoreObjectId; if (occurrenceStoreObjectId != null) { storeObjectId = occurrenceStoreObjectId.GetMasterStoreObjectId(); } string text = IdConverter.Instance.ToStringId(storeObjectId, this.mailboxSession); EventReference eventReference = new EventReference(XSOFactory.Default, this.mailboxSession, text); IEvents events = eventReference.Events; Event @event = events.Read(text, null); if (@event.PatternedRecurrence != null) { ExpandedEvent expandedEvent = events.Expand(@event.Id, new ExpandEventParameters { ReturnExceptions = true, ReturnCancellations = true }, null); deletedOccurrences = expandedEvent.CancelledOccurrences; exceptionalOccurrences = this.FilterOutNonExceptionalProperties(expandedEvent.Occurrences); } result = @event; } catch (ObjectNotFoundException) { MrsTracer.Provider.Warning("StorageActionsSource.GetCalendarEventData unable to locate the event to replay.", new object[0]); result = null; } return(result); }
protected virtual IList <string> GetDeletedOccurrenceIds(Event master, ExDateTime windowStart, ExDateTime windowEnd) { List <string> list = new List <string>(); StoreId storeId = IdConverter.Instance.GetStoreId(master); using (ICalendarItemBase calendarItemBase = this.Scope.EventDataProvider.BindToStoreObject(storeId)) { CalendarItem calendarItem = calendarItemBase as CalendarItem; if (calendarItem != null && calendarItem.Recurrence != null) { ExDateTime[] deletedOccurrences = calendarItem.Recurrence.GetDeletedOccurrences(); foreach (ExDateTime exDateTime in deletedOccurrences) { ExDateTime endTime = exDateTime.Add(master.End.Subtract(master.Start)); if (CalendarFolder.IsInWindow(windowStart, windowEnd, exDateTime, endTime)) { OccurrenceStoreObjectId storeId2 = new OccurrenceStoreObjectId(StoreId.GetStoreObjectId(storeId).ProviderLevelItemId, exDateTime); list.Add(IdConverter.Instance.ToStringId(storeId2, this.Scope.Session)); } } } } return(list); }