Example #1
0
        private ParticipantOrigin GetOriginFromStore(EmailAddressWrapper emailAddressWrapper)
        {
            StoreId storeId = null;

            try
            {
                storeId = IdConverter.ConvertItemIdToStoreId(emailAddressWrapper.ItemId, BasicTypes.Item);
            }
            catch (Exception ex)
            {
                this.LogException(ex, "Error occurred when getting store id from item id: {0}", new object[]
                {
                    emailAddressWrapper.ItemId
                });
            }
            if (storeId == null)
            {
                return(new OneOffParticipantOrigin());
            }
            int emailAddressIndex;

            if (!string.IsNullOrEmpty(emailAddressWrapper.EmailAddressIndex) && int.TryParse(emailAddressWrapper.EmailAddressIndex, out emailAddressIndex))
            {
                return(new StoreParticipantOrigin(storeId, (EmailAddressIndex)emailAddressIndex));
            }
            return(new StoreParticipantOrigin(storeId));
        }
        // Token: 0x060015C2 RID: 5570 RVA: 0x0004E184 File Offset: 0x0004C384
        private static EmailAddressWrapper ConvertParticipantToEmailAddressWrapper(IParticipant participant)
        {
            ParticipantInformationDictionary participantInformation            = EWSSettings.ParticipantInformation;
            ParticipantInformation           participantInformationOrCreateNew = participantInformation.GetParticipantInformationOrCreateNew(participant);

            return(EmailAddressWrapper.FromParticipantInformation(participantInformationOrCreateNew));
        }
        // Token: 0x0600150D RID: 5389 RVA: 0x0004AE50 File Offset: 0x00049050
        private static EmailAddressWrapper[] IntersectAndReturnEmailAddressWrappers(List <string> listA, List <string> listB)
        {
            EmailAddressWrapper[] array = null;
            List <string>         list;

            if (listA == null)
            {
                list = listB;
            }
            else if (listB == null)
            {
                list = listA;
            }
            else
            {
                list = listA.Intersect(listB, StringComparer.OrdinalIgnoreCase).ToList <string>();
            }
            if (list != null)
            {
                array = new EmailAddressWrapper[list.Count];
                int num = 0;
                foreach (string emailAddress in list)
                {
                    EmailAddressWrapper emailAddressWrapper = new EmailAddressWrapper();
                    emailAddressWrapper.EmailAddress = emailAddress;
                    array[num++] = emailAddressWrapper;
                }
            }
            return(array);
        }
Example #4
0
        private Participant[] GetAllParticipants()
        {
            Participant[] array = new Participant[this.request.Recipients.Length];
            for (int i = 0; i < this.request.Recipients.Length; i++)
            {
                EmailAddressWrapper emailAddressWrapper = this.request.Recipients[i];
                try
                {
                    if (emailAddressWrapper == null)
                    {
                        ExTraceGlobals.RequestTracer.TraceDebug <string>((long)this.GetHashCode(), "Recipients in GetCertsRequest should not contain any null values: {0}", JsonConverter.ToJSON(this.request));
                    }
                    else
                    {
                        string            mailboxType;
                        ParticipantOrigin origin;
                        switch (mailboxType = emailAddressWrapper.MailboxType)
                        {
                        case "OneOff":
                            origin = new OneOffParticipantOrigin();
                            goto IL_146;

                        case "Contact":
                        case "PrivateDL":
                            if (emailAddressWrapper.ItemId != null)
                            {
                                origin = this.GetOriginFromStore(emailAddressWrapper);
                                goto IL_146;
                            }
                            if (!string.IsNullOrEmpty(emailAddressWrapper.EmailAddress))
                            {
                                origin = this.GetOriginFromDirectory(emailAddressWrapper);
                                goto IL_146;
                            }
                            origin = new OneOffParticipantOrigin();
                            goto IL_146;
                        }
                        if (!string.IsNullOrEmpty(emailAddressWrapper.EmailAddress))
                        {
                            origin = this.GetOriginFromDirectory(emailAddressWrapper);
                        }
                        else
                        {
                            origin = new OneOffParticipantOrigin();
                        }
IL_146:
                        array[i] = new Participant(emailAddressWrapper.Name, emailAddressWrapper.EmailAddress, emailAddressWrapper.RoutingType, emailAddressWrapper.OriginalDisplayName, origin, new KeyValuePair <PropertyDefinition, object> [0]);
                    }
                }
                catch (Exception ex)
                {
                    this.LogException(ex, "Error occurred when getting participant from EmailAddress: {0}", new object[]
                    {
                        this.EmailAddressToString(emailAddressWrapper)
                    });
                }
            }
            return(array);
        }
Example #5
0
 // Token: 0x06001AB3 RID: 6835 RVA: 0x00064A44 File Offset: 0x00062C44
 public GetPersonaNotesCommand(CallContext callContext, string personaId, EmailAddressWrapper emailAddress, int maxBytesToFetch, TargetFolderId folderId = null) : base(callContext)
 {
     this.personaId          = personaId;
     this.maxBytesToFetch    = maxBytesToFetch;
     this.emailAddress       = emailAddress;
     this.adRecipientSession = base.CallContext.ADRecipientSessionContext.GetGALScopedADRecipientSession(base.CallContext.EffectiveCaller.ClientSecurityContext);
     this.folderId           = folderId;
 }
Example #6
0
        private ParticipantOrigin GetOriginFromDirectory(EmailAddressWrapper emailAddressWrapper)
        {
            ADRecipient adRecipient = this.GetAdRecipient(emailAddressWrapper.EmailAddress);

            if (adRecipient != null)
            {
                return(new DirectoryParticipantOrigin(adRecipient));
            }
            return(new OneOffParticipantOrigin());
        }
 // Token: 0x06001BFA RID: 7162 RVA: 0x0006D3B0 File Offset: 0x0006B5B0
 private static GetMailTipsResponseMessage GetMailTipsForUsers(UserContext userContext, string[] userIds)
 {
     EmailAddressWrapper[] array = new EmailAddressWrapper[userIds.Length];
     for (int i = 0; i < userIds.Length; i++)
     {
         array[i] = new EmailAddressWrapper();
         array[i].EmailAddress = userIds[i];
     }
     return(UpdateAttachmentPermissions.InvokeGetMailTipsSynchronous(userContext, new GetMailTipsRequest
     {
         Recipients = array,
         MailTipsRequested = MailTipTypes.TotalMemberCount
     }));
 }
Example #8
0
        // Token: 0x06001BA8 RID: 7080 RVA: 0x0006A100 File Offset: 0x00068300
        internal ADRecipient GetADRecipient(EmailAddressWrapper recipient)
        {
            ADRecipient result = null;

            if (recipient.RoutingType.Equals("SMTP", StringComparison.OrdinalIgnoreCase))
            {
                Directory.TryFindRecipient(recipient.EmailAddress, this.ADRecipientSession, out result);
            }
            else if (recipient.RoutingType.Equals("EX", StringComparison.OrdinalIgnoreCase))
            {
                result = this.ADRecipientSession.FindByLegacyExchangeDN(recipient.EmailAddress);
            }
            return(result);
        }
 // Token: 0x06001CAF RID: 7343 RVA: 0x00072CBC File Offset: 0x00070EBC
 private static EmailAddressAttributedValue[] GetEmailAddressAttribValue(EmailAddressWrapper value)
 {
     if (value != null)
     {
         return(new EmailAddressAttributedValue[]
         {
             new EmailAddressAttributedValue(value, new string[]
             {
                 "0"
             })
         });
     }
     return(null);
 }
        // Token: 0x06001CAD RID: 7341 RVA: 0x00072ACC File Offset: 0x00070CCC
        private static Persona GetPersonaFromUser(ADRecipient recipient)
        {
            Persona persona = new Persona();

            persona.PersonaId   = new ItemId(IdConverter.ADObjectIdToEwsId(recipient.Id), null);
            persona.DisplayName = recipient.DisplayName;
            EmailAddressWrapper emailAddressWrapper = new EmailAddressWrapper();

            emailAddressWrapper.EmailAddress = recipient.PrimarySmtpAddress.ToString();
            emailAddressWrapper.Name         = recipient.PrimarySmtpAddress.ToString();
            persona.EmailAddress             = emailAddressWrapper;
            persona.EmailAddresses           = new EmailAddressWrapper[]
            {
                emailAddressWrapper
            };
            persona.Attributions = new Attribution[]
            {
                new Attribution("0", new ItemId(), WellKnownNetworkNames.GAL)
                {
                    IsWritable     = false,
                    IsQuickContact = false,
                    IsHidden       = false,
                    FolderId       = null
                }
            };
            IADOrgPerson iadorgPerson = recipient as IADOrgPerson;

            if (iadorgPerson != null)
            {
                persona.GivenName   = iadorgPerson.FirstName;
                persona.CompanyName = iadorgPerson.Company;
                persona.Surname     = iadorgPerson.LastName;
                persona.Title       = iadorgPerson.Title;
                Microsoft.Exchange.Services.Core.Types.PhoneNumber phoneNumber = new Microsoft.Exchange.Services.Core.Types.PhoneNumber();
                phoneNumber.Number           = iadorgPerson.Phone;
                phoneNumber.Type             = PersonPhoneNumberType.Business;
                persona.PhoneNumber          = phoneNumber;
                persona.DisplayNames         = FindPeopleSpeechRecognitionResultHandler.GetStringAttribValue(persona.DisplayName);
                persona.GivenNames           = FindPeopleSpeechRecognitionResultHandler.GetStringAttribValue(persona.GivenName);
                persona.Surnames             = FindPeopleSpeechRecognitionResultHandler.GetStringAttribValue(persona.Surname);
                persona.CompanyNames         = FindPeopleSpeechRecognitionResultHandler.GetStringAttribValue(persona.CompanyName);
                persona.Titles               = FindPeopleSpeechRecognitionResultHandler.GetStringAttribValue(persona.Title);
                persona.OfficeLocations      = FindPeopleSpeechRecognitionResultHandler.GetStringAttribValue(iadorgPerson.Office);
                persona.Emails1              = FindPeopleSpeechRecognitionResultHandler.GetEmailAddressAttribValue(emailAddressWrapper);
                persona.BusinessPhoneNumbers = FindPeopleSpeechRecognitionResultHandler.GetPhoneNumberAttribValue(phoneNumber);
            }
            return(persona);
        }
Example #11
0
        private string EmailAddressToString(EmailAddressWrapper address)
        {
            if (address == null)
            {
                return("_");
            }
            string text;

            if ((text = address.Name) == null)
            {
                text = (address.OriginalDisplayName ?? "_");
            }
            string str = text;
            string text2;

            if ((text2 = address.EmailAddress) == null && (text2 = address.MailboxType) == null)
            {
                text2 = (address.RoutingType ?? "_");
            }
            string str2 = text2;

            return(str + " <" + str2 + ">");
        }
Example #12
0
        private EmailAddressWrapper GetEmailAddressWrapper(Participant p, string mailBoxType)
        {
            EmailAddressWrapper emailAddressWrapper = new EmailAddressWrapper();
            string      paticipantAddress;
            ADRecipient adRecipient;

            if (!string.IsNullOrEmpty(paticipantAddress = this.GetPaticipantAddress(p)) && (adRecipient = this.GetAdRecipient(paticipantAddress)) != null)
            {
                emailAddressWrapper.Name         = adRecipient.DisplayName;
                emailAddressWrapper.EmailAddress = adRecipient.PrimarySmtpAddress.ToString();
                emailAddressWrapper.MailboxType  = "Mailbox";
                emailAddressWrapper.RoutingType  = "SMTP";
            }
            else
            {
                emailAddressWrapper.Name = p.DisplayName;
                emailAddressWrapper.OriginalDisplayName = p.OriginalDisplayName;
                emailAddressWrapper.EmailAddress        = this.GetPaticipantAddress(p);
                emailAddressWrapper.MailboxType         = mailBoxType;
                emailAddressWrapper.RoutingType         = p.RoutingType;
            }
            return(emailAddressWrapper);
        }
Example #13
0
        private EmailAddressWrapper[] GetCertsFromPrivateDL(Participant p, bool isCurrent)
        {
            Participant[] array = null;
            try
            {
                StoreObjectId originItemId = ((StoreParticipantOrigin)p.Origin).OriginItemId;
                array = DistributionList.ExpandDeep(this.storeSession, originItemId, false);
                if (array == null || array.Length == 0)
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                this.LogException(ex, "Error occurred when expanding PrivateDL: {0}", new object[]
                {
                    this.ParticipantToString(p)
                });
                return(this.GetCurrent(p, isCurrent, "PrivateDL"));
            }
            List <EmailAddressWrapper> list = new List <EmailAddressWrapper>();

            foreach (Participant participant in array)
            {
                string paticipantAddress = this.GetPaticipantAddress(participant);
                if (participant.Origin is StoreParticipantOrigin)
                {
                    EmailAddressWrapper[] collection;
                    if (string.IsNullOrEmpty(paticipantAddress))
                    {
                        if ((collection = this.GetCertsFromPrivateDL(participant, false)) != null)
                        {
                            list.AddRange(collection);
                        }
                    }
                    else if ((collection = this.GetCertsFromContact(participant, false)) != null)
                    {
                        list.AddRange(collection);
                    }
                }
                else if (participant.Origin is DirectoryParticipantOrigin)
                {
                    EmailAddressWrapper[] certsFromDirectory;
                    if ((certsFromDirectory = this.GetCertsFromDirectory(participant, false)) != null)
                    {
                        list.AddRange(certsFromDirectory);
                    }
                }
                else if (!string.IsNullOrEmpty(paticipantAddress))
                {
                    ADRecipient           adRecipient = this.GetAdRecipient(paticipantAddress);
                    EmailAddressWrapper[] certsFromDirectory;
                    if (adRecipient == null)
                    {
                        EmailAddressWrapper emailAddressWrapper = this.GetEmailAddressWrapper(participant, "OneOff");
                        list.Add(emailAddressWrapper);
                    }
                    else if ((certsFromDirectory = this.GetCertsFromDirectory(new Participant(adRecipient), false)) != null)
                    {
                        list.AddRange(certsFromDirectory);
                    }
                }
                else
                {
                    EmailAddressWrapper emailAddressWrapper2 = this.GetEmailAddressWrapper(participant, "Unknown");
                    list.Add(emailAddressWrapper2);
                }
            }
            return(list.ToArray());
        }
Example #14
0
        protected override GetCertsResponse InternalExecute()
        {
            ExDateTime       now = ExDateTime.Now;
            GetCertsResponse getCertsResponse = new GetCertsResponse();

            try
            {
                if (this.request.Recipients == null || this.request.Recipients.Length == 0)
                {
                    GetCertsResponse getCertsResponse2 = new GetCertsResponse();
                    getCertsResponse2.ErrorStatus = GetCertsErrorStatus.InvalidRequest;
                    ExTraceGlobals.RequestTracer.TraceDebug <string>((long)this.GetHashCode(), "The GetCertsRequest is invalid: {0}", JsonConverter.ToJSON(this.request));
                    return(getCertsResponse2);
                }
                ExTraceGlobals.RequestTracer.TraceDebug <string>((long)this.GetHashCode(), "Recipients in GetCertsRequest: {0}", this.EmailAddressToString(this.request.Recipients));
                Participant[]           allParticipants = this.GetAllParticipants();
                EmailAddressWrapper[][] array           = new EmailAddressWrapper[allParticipants.Length][];
                this.allCerts = new List <byte[]> [this.request.Recipients.Length];
                this.current  = 0;
                while (this.current < allParticipants.Length)
                {
                    Participant participant = allParticipants[this.current];
                    if (participant.Origin is StoreParticipantOrigin)
                    {
                        if (string.IsNullOrEmpty(this.GetPaticipantAddress(participant)))
                        {
                            array[this.current] = this.GetCertsFromPrivateDL(participant, true);
                        }
                        else
                        {
                            array[this.current] = this.GetCertsFromContact(participant, true);
                        }
                    }
                    else if (participant.Origin is DirectoryParticipantOrigin)
                    {
                        array[this.current] = this.GetCertsFromDirectory(participant, true);
                    }
                    else
                    {
                        array[this.current] = new EmailAddressWrapper[]
                        {
                            this.request.Recipients[this.current]
                        };
                    }
                    this.current++;
                }
                bool flag = false;
                for (int i = 0; i < array.Length; i++)
                {
                    if (array[i] != null && array[i].Length > 0)
                    {
                        flag = true;
                        break;
                    }
                }
                List <string[]> list = new List <string[]>(this.allCerts.Length);
                foreach (List <byte[]> list2 in this.allCerts)
                {
                    if (list2 != null && list2.Count > 0)
                    {
                        List <string> list3 = new List <string>(list2.Count);
                        foreach (byte[] array3 in list2)
                        {
                            if (array3 != null && array3.Length > 0)
                            {
                                list3.Add(Convert.ToBase64String(array3));
                            }
                        }
                        list.Add(list3.ToArray());
                    }
                    else
                    {
                        list.Add(null);
                    }
                }
                getCertsResponse.ErrorStatus       = this.errorStatus;
                getCertsResponse.InvalidRecipients = (flag ? array : null);
                getCertsResponse.ValidRecipients   = list.ToArray();
            }
            catch (Exception ex)
            {
                this.LogException(ex, "Unknown error occurred", new object[0]);
                getCertsResponse.ErrorStatus       = GetCertsErrorStatus.UnknownError;
                getCertsResponse.InvalidRecipients = null;
                getCertsResponse.ValidRecipients   = null;
            }
            finally
            {
                getCertsResponse.ErrorDetails = this.errors.ToArray();
                ExTraceGlobals.RequestTracer.TracePerformance <TimeSpan>((long)this.GetHashCode(), "Elapsed time in GetCerts call: ", ExDateTime.Now - now);
            }
            return(getCertsResponse);
        }
 // Token: 0x0600189A RID: 6298 RVA: 0x00054BD0 File Offset: 0x00052DD0
 public GetPersonaOrganizationHierarchyCommand(CallContext callContext, string galObjectGuid, EmailAddressWrapper emailAddress) : base(callContext)
 {
     this.adRecipientSession = base.CallContext.ADRecipientSessionContext.GetGALScopedADRecipientSession(base.CallContext.EffectiveCaller.ClientSecurityContext);
     this.galObjectGuid      = galObjectGuid;
     this.emailAddress       = emailAddress;
 }
Example #16
0
 public GetGroupCommand(CallContext callContext, ItemId itemId, string adObjectId, EmailAddressWrapper emailAddress, IndexedPageView paging, GetGroupResultSet resultSet, TargetFolderId folderId = null) : base(callContext)
 {
     if (itemId == null && (emailAddress == null || string.IsNullOrEmpty(emailAddress.EmailAddress)) && string.IsNullOrEmpty(adObjectId))
     {
         throw new ArgumentException("Must specify itemId, adObjectId or legacyExchangeDN");
     }
     if (paging == null)
     {
         throw new ArgumentNullException("paging");
     }
     this.itemId     = itemId;
     this.adObjectId = adObjectId;
     if (emailAddress != null && emailAddress.RoutingType != null)
     {
         if (emailAddress.RoutingType.Equals("EX", StringComparison.OrdinalIgnoreCase))
         {
             this.legacyExchangeDN = emailAddress.EmailAddress;
         }
         else if (emailAddress.RoutingType.Equals("SMTP", StringComparison.OrdinalIgnoreCase))
         {
             this.smtpAddress = emailAddress.EmailAddress;
         }
     }
     this.paging         = paging;
     this.resultSet      = resultSet;
     this.hashCode       = this.GetParamsHashCode();
     this.parentFolderid = folderId;
 }
Example #17
0
 internal static InstantMessageBuddy Create(string guid, string sipUri, string displayName, EmailAddressWrapper emailAddress)
 {
     return(new InstantMessageBuddy
     {
         Guid = guid,
         SipUri = InstantMessageUtilities.ToSipFormat(sipUri),
         DisplayName = displayName,
         AddressType = 0,
         groups = new Dictionary <string, InstantMessageGroup>(),
         Tagged = false,
         FirstName = null,
         LastName = null,
         EmailAddress = emailAddress
     });
 }