예제 #1
0
        protected bool GetExchangeParticipantsFromRecipientInfo(RecipientInfo recipientInfo, List <Participant> exchangeParticipants)
        {
            bool        flag = false;
            Participant item = null;

            this.AnrOptions.ResolveContactsFirst = base.UserContext.UserOptions.CheckNameInContactsFirst;
            if (recipientInfo.PendingChunk != null)
            {
                RecipientCache recipientCache = AutoCompleteCache.TryGetCache(OwaContext.Current.UserContext);
                ArrayList      arrayList      = new ArrayList();
                RecipientWell.ResolveAndRenderChunk(this.Writer, recipientInfo.PendingChunk, arrayList, recipientCache, base.UserContext, this.AnrOptions);
                for (int i = 0; i < arrayList.Count; i++)
                {
                    RecipientWellNode recipientWellNode = (RecipientWellNode)arrayList[i];
                    flag |= Utilities.CreateExchangeParticipant(out item, recipientWellNode.DisplayName, recipientWellNode.RoutingAddress, recipientWellNode.RoutingType, recipientWellNode.AddressOrigin, recipientWellNode.StoreObjectId, recipientWellNode.EmailAddressIndex);
                    exchangeParticipants.Add(item);
                }
            }
            else
            {
                flag |= recipientInfo.ToParticipant(out item);
                exchangeParticipants.Add(item);
            }
            return(flag);
        }
예제 #2
0
        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 ExpandDistributionList()
        {
            ExTraceGlobals.MailCallTracer.TraceDebug((long)this.GetHashCode(), "RecipientWellEventHandler.ExpandDistributionList");
            RecipientInfo[]    array = (RecipientInfo[])base.GetParameter("Recips");
            List <Participant> list  = new List <Participant>();

            foreach (RecipientInfo recipientInfo in array)
            {
                if (recipientInfo.StoreObjectId == null || !Utilities.IsMapiPDL(recipientInfo.RoutingType))
                {
                    throw new OwaEventHandlerException("The requested recipient is not personal distribution list");
                }
                list.AddRange(DistributionList.ExpandDeep(base.UserContext.MailboxSession, recipientInfo.StoreObjectId));
            }
            using (List <Participant> .Enumerator enumerator = list.GetEnumerator())
            {
                AdRecipientBatchQuery adRecipientBatchQuery = new AdRecipientBatchQuery(enumerator, base.UserContext);
                bool flag = false;
                foreach (Participant participant in list)
                {
                    string            smtpAddress       = null;
                    string            sipUri            = null;
                    ADObjectId        adObjectId        = null;
                    StoreObjectId     storeObjectId     = null;
                    EmailAddressIndex emailAddressIndex = EmailAddressIndex.None;
                    string            mobilePhoneNumber = null;
                    if (participant.RoutingType == "EX")
                    {
                        ADRecipient adRecipient = adRecipientBatchQuery.GetAdRecipient(participant.EmailAddress);
                        if (adRecipient != null)
                        {
                            smtpAddress       = adRecipient.PrimarySmtpAddress.ToString();
                            adObjectId        = adRecipient.Id;
                            sipUri            = InstantMessageUtilities.GetSipUri((ProxyAddressCollection)adRecipient[ADRecipientSchema.EmailAddresses]);
                            mobilePhoneNumber = Utilities.NormalizePhoneNumber((string)adRecipient[ADOrgPersonSchema.MobilePhone]);
                        }
                    }
                    else
                    {
                        smtpAddress = participant.EmailAddress;
                        sipUri      = participant.EmailAddress;
                    }
                    RecipientAddress.RecipientAddressFlags recipientAddressFlags = RecipientAddress.RecipientAddressFlags.None;
                    if (participant.GetValueOrDefault <bool>(ParticipantSchema.IsDistributionList))
                    {
                        recipientAddressFlags |= RecipientAddress.RecipientAddressFlags.DistributionList;
                    }
                    else if (participant.GetValueOrDefault <bool>(ParticipantSchema.IsRoom))
                    {
                        recipientAddressFlags |= RecipientAddress.RecipientAddressFlags.Room;
                    }
                    StoreParticipantOrigin storeParticipantOrigin = participant.Origin as StoreParticipantOrigin;
                    if (storeParticipantOrigin != null)
                    {
                        storeObjectId     = storeParticipantOrigin.OriginItemId;
                        emailAddressIndex = storeParticipantOrigin.EmailAddressIndex;
                    }
                    RecipientWellNode.Render(this.Writer, base.UserContext, participant.DisplayName, smtpAddress, participant.EmailAddress, participant.RoutingType, participant.GetValueOrDefault <string>(ParticipantSchema.Alias), RecipientAddress.ToAddressOrigin(participant), (int)recipientAddressFlags, storeObjectId, emailAddressIndex, adObjectId, flag ? RecipientWellNode.RenderFlags.RenderCommas : RecipientWellNode.RenderFlags.None, sipUri, mobilePhoneNumber);
                    flag = true;
                }
            }
        }