private IEnumerable <UserObject> ExtractAttendees(IAttendeeCollection attendeeCollection, Participant organizerParticipant, bool dlParticipantsOnly) { Dictionary <ADObjectId, UserObject> dictionary = new Dictionary <ADObjectId, UserObject>(attendeeCollection.Count); HashSet <ADObjectId> hashSet = new HashSet <ADObjectId>(); Dictionary <ProxyAddress, UserObject> dictionary2 = new Dictionary <ProxyAddress, UserObject>(); int expandedDLCount = 0; foreach (Attendee attendee in attendeeCollection) { if (CalendarValidator.IsValidParticipant(attendee.Participant)) { ProxyAddress attendeeProxyAddress = ProxyAddress.Parse(attendee.Participant.RoutingType, attendee.Participant.EmailAddress); ADRecipient attendeeRecipient = null; ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate() { attendeeRecipient = this.recipientSession.FindByProxyAddress(attendeeProxyAddress); }); if (!adoperationResult.Succeeded || attendeeRecipient == null) { this.ExtractUnaccessibleAttendee(organizerParticipant, dictionary2, attendee, attendeeProxyAddress); } else if (hashSet.Contains(attendeeRecipient.Id)) { AttendeeExtractor.RevisitAttendee(dictionary, attendee, attendeeRecipient); } else if (attendeeRecipient is ADGroup) { AttendeeExtractor.DLExpansionHandler dlexpansionHandler = new AttendeeExtractor.DLExpansionHandler(organizerParticipant, dictionary, hashSet, expandedDLCount, attendee, attendeeRecipient, this.recipientSession, this.expansionManager); expandedDLCount = dlexpansionHandler.ExpandDL(); } else if (!dlParticipantsOnly) { hashSet.Add(attendeeRecipient.Id); AttendeeExtractor.DLExpansionHandler.AddOrganizerFilteredAttendee <ADObjectId>(dictionary, attendeeRecipient.Id, new UserObject(attendee, attendeeRecipient, this.recipientSession), organizerParticipant, this.recipientSession); } } } return(dictionary.Values.Concat(dictionary2.Values)); }
internal static CalendarValidationContext CreateInstance(CalendarItemBase calendarItem, bool isOrganizer, UserObject localUser, UserObject remoteUser, CalendarVersionStoreGateway cvsGateway, AttendeeExtractor attendeeExtractor) { CalendarValidationContext calendarValidationContext = new CalendarValidationContext(); calendarValidationContext.LocalUser = localUser; calendarValidationContext.RemoteUser = remoteUser; if (isOrganizer) { calendarValidationContext.BaseRole = RoleType.Organizer; calendarValidationContext.OppositeRole = RoleType.Attendee; calendarValidationContext.Organizer = localUser; calendarValidationContext.Attendee = remoteUser; } else { calendarValidationContext.BaseRole = RoleType.Attendee; calendarValidationContext.OppositeRole = RoleType.Organizer; calendarValidationContext.Organizer = remoteUser; calendarValidationContext.Attendee = localUser; } calendarValidationContext.calendarItems = new Dictionary <RoleType, CalendarItemBase>(2); calendarValidationContext.calendarItems.Add(calendarValidationContext.BaseRole, calendarItem); calendarValidationContext.calendarItems.Add(calendarValidationContext.OppositeRole, null); calendarValidationContext.OrganizerRecurrence = null; calendarValidationContext.OrganizerExceptions = null; calendarValidationContext.OrganizerDeletions = null; calendarValidationContext.AttendeeRecurrence = null; calendarValidationContext.AttendeeExceptions = null; calendarValidationContext.AttendeeDeletions = null; calendarValidationContext.OppositeRoleOrganizerIsValid = false; calendarValidationContext.CvsGateway = cvsGateway; calendarValidationContext.AttendeeExtractor = attendeeExtractor; return(calendarValidationContext); }