private void UpdateMatchCollection(CalendarCorrelationMatch matchData) { if (matchData.IsCorrelated) { bool flag = false; if (this.FoundMatches.Count == 0) { flag = true; } else { if (this.IsMasterMatch == null) { throw new ArgumentNullException("isPreviousMasterMatchingTheOccurrence"); } if (this.IsMasterMatch.Value == matchData.isMasterMatchingTheOccurrence) { flag = true; } else if (this.IsMasterMatch.Value) { flag = true; this.FoundMatches.Clear(); } } if (flag) { this.FoundMatches.Add(matchData); this.IsMasterMatch = new bool?(matchData.isMasterMatchingTheOccurrence); } } }
private void ThrowIfCopyMovePrereqsFail(MailboxSession destinationSession, StoreObjectId destinationFolderId, bool isCopy) { Util.ThrowOnNullArgument(destinationFolderId, "destinationFolderId"); if (destinationFolderId.ObjectType != StoreObjectType.CalendarFolder) { throw new ArgumentException("Destination folder must be a calendar folder", "destinationFolderId"); } if (!(base.Session is MailboxSession)) { throw new InvalidOperationException("Only mailbox sessions are supported"); } if (base.ParentId.Equals(destinationFolderId)) { throw new ArgumentException("The destination folder must be different from the source folder.", "destinationFolderId"); } if (!this.IsInThePast) { throw new FutureMeetingException("Only meetings in the past can be copied or moved"); } if (isCopy) { StoreObjectId defaultFolderId = ((MailboxSession)base.Session).GetDefaultFolderId(DefaultFolderType.Calendar); if (base.ParentId.Equals(defaultFolderId) || destinationFolderId.Equals(defaultFolderId)) { throw new PrimaryCalendarFolderException("Copy is not allowed to/from the primary calendar"); } } using (CalendarFolder calendarFolder = CalendarFolder.Bind(destinationSession, destinationFolderId)) { IList list = CalendarCorrelationMatch.FindMatches(calendarFolder, base.GlobalObjectId, null); if (list.Count > 0) { throw new CalendarItemExistsException("There is already a calendar item with this GOID in the destination folder"); } } }
public void AddMatch(GlobalObjectId globalObjectId, PropertyBag propertyBag) { CalendarCorrelationMatch matchData = new CalendarCorrelationMatch(propertyBag, globalObjectId); this.UpdateMatchCollection(matchData); }