private void UpdateParticipantsOnCalendarItem(CalendarItemBase calendarItem, bool isReadOnlyItem) { this.CheckDisposed("ProcessParticipants"); base.LocationIdentifierHelperInstance.SetLocationIdentifier(62325U, LastChangeAction.ProcessParticipants); IAttendeeCollection attendeeCollection = calendarItem.AttendeeCollection; calendarItem.LocationIdentifierHelperInstance.SetLocationIdentifier(37749U); attendeeCollection.Clear(); bool flag = false; if (base.From != null) { calendarItem.LocationIdentifierHelperInstance.SetLocationIdentifier(54133U); attendeeCollection.Add(base.From, AttendeeType.Required, null, null, false).RecipientFlags = (RecipientFlags.Sendable | RecipientFlags.Organizer); flag = true; } List <BlobRecipient> list = this.GetUnsendableRecipients(); if (!isReadOnlyItem) { this.SetUnsendableRecipients(list); } list = MeetingRequest.MergeRecipientLists(base.Recipients, list); Participant participant = null; if (base.IsDelegated()) { participant = (Participant)base.TryGetProperty(InternalSchema.ReceivedBy); } foreach (BlobRecipient blobRecipient in list) { RecipientFlags valueOrDefault = blobRecipient.GetValueOrDefault <RecipientFlags>(InternalSchema.RecipientFlags); bool flag2 = (valueOrDefault & RecipientFlags.Organizer) == RecipientFlags.Organizer; if (flag2) { if (flag) { continue; } flag = true; } if (!blobRecipient.Participant.AreAddressesEqual(base.From)) { RecipientItemType type = MapiUtil.MapiRecipientTypeToRecipientItemType(blobRecipient.GetValueOrDefault <RecipientType>(InternalSchema.RecipientType, RecipientType.To)); AttendeeType attendeeType = Attendee.RecipientItemTypeToAttendeeType(type); Participant participant2 = blobRecipient.Participant; if (participant != null && Participant.HasSameEmail(participant2, participant, base.MailboxSession, true)) { calendarItem.LocationIdentifierHelperInstance.SetLocationIdentifier(41845U); attendeeCollection.Add(base.ReceivedRepresenting, attendeeType, null, null, false); participant = null; } else { calendarItem.LocationIdentifierHelperInstance.SetLocationIdentifier(58229U); attendeeCollection.Add(participant2, attendeeType, null, null, false); } } } }
internal static Attendee InternalAdd(IAttendeeCollection attendeeCollection, Func <Attendee> performAdd, Participant participant, AttendeeType attendeeType = AttendeeType.Required, ResponseType?responseType = null, bool checkExisting = false) { if (participant == null) { throw new ArgumentNullException("participant"); } EnumValidator.ThrowIfInvalid <AttendeeType>(attendeeType, "attendeeType"); if (responseType != null) { EnumValidator.ThrowIfInvalid <ResponseType>(responseType.Value, "responseType"); } if (checkExisting) { int num = AttendeeCollection.IndexOf(attendeeCollection, participant, false); if (num != -1) { Attendee attendee = attendeeCollection[num]; if (attendeeType != AttendeeType.Required || attendee.AttendeeType == AttendeeType.Required) { return(attendee); } attendeeCollection.RemoveAt(num); } } return(performAdd()); }
internal static void Cleanup(IAttendeeCollection attendees) { HashSet <string> hashSet = new HashSet <string>(); List <Attendee> list = new List <Attendee>(); foreach (Attendee attendee in attendees) { if (attendee.Participant.RoutingType == "SMTP" || attendee.Participant.RoutingType == "EX") { RecipientFlags recipientFlags = attendee.RecipientFlags; bool flag = (recipientFlags & RecipientFlags.ExceptionalDeleted) == RecipientFlags.ExceptionalDeleted; string item = attendee.GetAttendeeKey() + (flag ? ":D" : ":ND"); if (!hashSet.Contains(item)) { hashSet.Add(item); } else { list.Add(attendee); } } } foreach (Attendee item2 in list) { attendees.Remove(item2); } }
private static EditCalendarItemHelper.CalendarItemUpdateFlags AddAttendees(IAttendeeCollection attendees, AttendeeType attendeeType, string wellName, UserContext userContext, HttpRequest request) { EditCalendarItemHelper.CalendarItemUpdateFlags calendarItemUpdateFlags = EditCalendarItemHelper.CalendarItemUpdateFlags.None; bool flag = false; Participant participant = null; string formParameter = Utilities.GetFormParameter(request, wellName, false); if (string.IsNullOrEmpty(formParameter)) { return(calendarItemUpdateFlags); } ArrayList arrayList = new ArrayList(); RecipientWell.ResolveRecipients(formParameter, arrayList, userContext, userContext.UserOptions.CheckNameInContactsFirst); for (int i = 0; i < arrayList.Count; i++) { RecipientWellNode recipientWellNode = (RecipientWellNode)arrayList[i]; flag |= Utilities.CreateExchangeParticipant(out participant, recipientWellNode.DisplayName, recipientWellNode.RoutingAddress, recipientWellNode.RoutingType, recipientWellNode.AddressOrigin, recipientWellNode.StoreObjectId, recipientWellNode.EmailAddressIndex); if (participant != null) { attendees.Add(participant, attendeeType, null, null, false); calendarItemUpdateFlags |= EditCalendarItemHelper.CalendarItemUpdateFlags.AttendeesChanged; } } if (flag) { calendarItemUpdateFlags |= EditCalendarItemHelper.CalendarItemUpdateFlags.HasUnresolvedAttendees; } return(calendarItemUpdateFlags); }
public void ToXso(IList <Attendee> attendees, ICalendarItemBase calendarItem) { if (calendarItem == null) { throw new ExArgumentNullException("calendarItem"); } if (calendarItem.IsOrganizer()) { IAttendeeCollection attendeeCollection = calendarItem.AttendeeCollection; attendeeCollection.Clear(); AttendeeConverter.StorageAttendeeData[] array; Participant[] array2; if (this.TryGetAttendeesData(calendarItem.Session, attendees, out array, out array2)) { for (int i = 0; i < array2.Length; i++) { AttendeeConverter.StorageAttendeeData storageAttendeeData = array[i]; calendarItem.AttendeeCollection.Add(array2[i], storageAttendeeData.AttendeeType, storageAttendeeData.ResponseType, storageAttendeeData.ReplyTime, true); } } if (calendarItem.AttendeeCollection.Count > 0) { calendarItem.IsMeeting = true; } } }
private static int IndexOf(IAttendeeCollection attendeeCollection, Participant participant, bool canLookup) { int count = attendeeCollection.Count; for (int i = 0; i < count; i++) { if (Participant.HasSameEmail(attendeeCollection[i].Participant, participant, canLookup)) { return(i); } } return(-1); }
private Attendee FindOrAddAttendee(CalendarItemBase calendarItem, out bool newAttendee) { IAttendeeCollection attendeeCollection = calendarItem.AttendeeCollection; Attendee attendee = base.FindAttendee(calendarItem); if (attendee == null && attendeeCollection != null && base.From != null) { ExTraceGlobals.MeetingMessageTracer.Information((long)this.GetHashCode(), "User not found, adding to the list."); attendee = attendeeCollection.Add(base.From, AttendeeType.Optional, null, null, false); newAttendee = true; } else { newAttendee = false; } return(attendee); }
private void CopyParticipantsToCalendarItem(CalendarItemBase calendarItem) { this.CheckDisposed("CopyParticipantsToCalendarItem"); base.LocationIdentifierHelperInstance.SetLocationIdentifier(44533U, LastChangeAction.CopyParticipantsToCalendarItem); IAttendeeCollection attendeeCollection = calendarItem.AttendeeCollection; calendarItem.LocationIdentifierHelperInstance.SetLocationIdentifier(60917U); attendeeCollection.Clear(); if (base.From != null) { calendarItem.LocationIdentifierHelperInstance.SetLocationIdentifier(36341U); attendeeCollection.Add(base.From, AttendeeType.Required, null, null, false).RecipientFlags = (RecipientFlags.Sendable | RecipientFlags.Organizer); } foreach (Recipient recipient in base.Recipients) { calendarItem.LocationIdentifierHelperInstance.SetLocationIdentifier(52725U); attendeeCollection.Add(recipient.Participant, Attendee.RecipientItemTypeToAttendeeType(recipient.RecipientItemType), null, null, false); } }
private bool AddAttendee(IAttendeeCollection attendees, Participant organizer, BlobRecipient recipient, ILocationIdentifierSetter locationIdentifierSetter) { Participant participant = recipient.Participant; MailboxSession mailboxSession = base.MailboxSession; if (Participant.HasSameEmail(participant, organizer, mailboxSession, true)) { return(false); } foreach (Attendee attendee in attendees) { if (Participant.HasSameEmail(participant, attendee.Participant, mailboxSession, true)) { return(false); } } locationIdentifierSetter.SetLocationIdentifier(43893U); attendees.Add(participant, AttendeeType.Optional, null, null, false); return(true); }
internal Attendee FindAttendee(CalendarItemBase calendarItem) { this.CheckDisposed("FindAttendee"); IAttendeeCollection attendeeCollection = calendarItem.AttendeeCollection; bool flag = false; Attendee attendee = null; bool flag2 = false; if (this.GetFromRecipient() == null) { if (base.From == null) { return(null); } flag2 = true; } for (int i = 0; i < attendeeCollection.Count; i++) { attendee = attendeeCollection[i]; bool flag3; if (flag2) { flag3 = base.From.AreAddressesEqual(attendee.Participant); } else { flag3 = Participant.HasProxyAddress(this.adFromRecipient, attendee.Participant); } if (flag3) { ExTraceGlobals.MeetingMessageTracer.Information((long)this.GetHashCode(), "User found in attendee list."); flag = true; break; } } if (!flag) { return(null); } return(attendee); }
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)); }
protected override void UpdateCalendarItemInternal(ref CalendarItemBase originalCalendarItem) { if (!this.IsMfnProcessed) { List <BlobRecipient> forwardedAttendees = this.GetForwardedAttendees(); IAttendeeCollection attendeeCollection = originalCalendarItem.AttendeeCollection; Participant organizer = originalCalendarItem.Organizer; List <BlobRecipient> list = new List <BlobRecipient>(); foreach (BlobRecipient blobRecipient in forwardedAttendees) { bool flag = this.AddAttendee(attendeeCollection, organizer, blobRecipient, originalCalendarItem.LocationIdentifierHelperInstance); if (flag) { list.Add(blobRecipient); } } if (list.Count > 0) { BlobRecipientParser.WriteRecipients(this, InternalSchema.MFNAddedRecipients, list); } this.SetCalendarProcessingSteps(CalendarProcessingSteps.ProcessedMeetingForwardNotification); } }
public void SendRumUpdate(ref CalendarItemBase originalCalendarItem) { if (originalCalendarItem == null) { return; } CalendarInconsistencyFlag inconsistencyFlag; if (this.MatchesOrganizerItem(ref originalCalendarItem, out inconsistencyFlag)) { return; } List <BlobRecipient> mfnaddedAttendees = this.GetMFNAddedAttendees(); IAttendeeCollection attendeeCollection = originalCalendarItem.AttendeeCollection; Participant organizer = originalCalendarItem.Organizer; List <Attendee> list = new List <Attendee>(); MailboxSession mailboxSession = base.MailboxSession; foreach (BlobRecipient blobRecipient in mfnaddedAttendees) { list.Add(originalCalendarItem.AttendeeCollection.Add(blobRecipient.Participant, AttendeeType.Required, null, null, false)); } if (list.Count > 0) { UpdateRumInfo rumInfo; if (originalCalendarItem.GlobalObjectId.IsCleanGlobalObjectId) { rumInfo = UpdateRumInfo.CreateMasterInstance(list, inconsistencyFlag); } else { rumInfo = UpdateRumInfo.CreateOccurrenceInstance(originalCalendarItem.GlobalObjectId.Date, list, inconsistencyFlag); } originalCalendarItem.SendUpdateRums(rumInfo, false); } }