Exemplo n.º 1
0
        private ParticipantTable CalculateReplyAllParticipants()
        {
            IParticipant valueOrDefault  = base.StorePropertyBag.GetValueOrDefault <IParticipant>(ItemSchema.From, null);
            IParticipant valueOrDefault2 = base.StorePropertyBag.GetValueOrDefault <IParticipant>(ItemSchema.Sender, null);
            IDictionary <RecipientItemType, HashSet <IParticipant> > dictionary = ReplyAllParticipantsRepresentationProperty <IParticipant> .BuildReplyAllRecipients <IParticipant>(valueOrDefault2, valueOrDefault, this.ReplyToParticipants, base.Recipients.ToDictionary(), ParticipantComparer.EmailAddress);

            ParticipantTable participantTable = new ParticipantTable();

            foreach (KeyValuePair <RecipientItemType, HashSet <IParticipant> > keyValuePair in dictionary)
            {
                participantTable.Add(keyValuePair.Key, keyValuePair.Value);
            }
            return(participantTable);
        }
        private bool TryExtractRecipients(IStorePropertyBag propertyBag, ParticipantTable recipientTable, IList <Participant> replyToParticipants)
        {
            IList <Participant> list = new List <Participant>();

            if (!this.TryGetParticipantsFromDisplayNameProperty(propertyBag, ItemSchema.DisplayTo, list))
            {
                return(false);
            }
            recipientTable.Add(RecipientItemType.To, list.ToArray <Participant>());
            list.Clear();
            if (!this.TryGetParticipantsFromDisplayNameProperty(propertyBag, ItemSchema.DisplayCc, list))
            {
                return(false);
            }
            recipientTable.Add(RecipientItemType.Cc, list.ToArray <Participant>());
            list.Clear();
            if (!this.TryGetParticipantsFromDisplayNameProperty(propertyBag, ItemSchema.DisplayBcc, list))
            {
                return(false);
            }
            recipientTable.Add(RecipientItemType.Bcc, list.ToArray <Participant>());
            return(this.TryGetParticipantsFromDisplayNameProperty(propertyBag, MessageItemSchema.ReplyToNames, replyToParticipants));
        }
        private bool TryGetParticipantsFromReplyAllParticipantsProperty(IStorePropertyBag propertyBag, SmartPropertyDefinition propertyDefinition, out ParticipantTable participantTable)
        {
            participantTable = new ParticipantTable();
            object obj = propertyBag.TryGetProperty(propertyDefinition);

            if (PropertyError.IsPropertyError(obj))
            {
                return(false);
            }
            IDictionary <RecipientItemType, HashSet <string> > dictionary = (IDictionary <RecipientItemType, HashSet <string> >)obj;

            foreach (KeyValuePair <RecipientItemType, HashSet <string> > keyValuePair in dictionary)
            {
                IList <Participant> participants = new List <Participant>();
                if (!this.TryResolveParticipants(keyValuePair.Value, participants))
                {
                    return(false);
                }
                participantTable.Add(keyValuePair.Key, participants);
            }
            return(true);
        }