private static Persona GetPersonaFromADObject(ADRawEntry rawEntry)
        {
            if (rawEntry == null)
            {
                return(null);
            }
            ADObjectId adobjectId = rawEntry[ADObjectSchema.Id] as ADObjectId;

            if (adobjectId == null)
            {
                return(null);
            }
            Persona persona = new Persona();

            persona.PersonaId = IdConverter.PersonaIdFromADObjectId(adobjectId.ObjectGuid);
            RecipientType        recipientType        = (RecipientType)rawEntry[ADRecipientSchema.RecipientType];
            PersonType           personType           = ADRecipient.IsRecipientTypeDL(recipientType) ? PersonType.DistributionList : PersonType.Person;
            RecipientTypeDetails recipientTypeDetails = (RecipientTypeDetails)rawEntry[ADRecipientSchema.RecipientTypeDetails];

            if (recipientTypeDetails == RecipientTypeDetails.GroupMailbox)
            {
                personType = PersonType.ModernGroup;
            }
            persona.PersonaType = PersonaTypeConverter.ToString(personType);
            object obj = rawEntry[ADRecipientSchema.DisplayName];

            if (obj != null)
            {
                persona.DisplayName = (obj as string);
            }
            object obj2 = rawEntry[ADRecipientSchema.PrimarySmtpAddress];

            if (obj2 != null)
            {
                persona.EmailAddress = new EmailAddressWrapper
                {
                    Name         = (persona.DisplayName ?? string.Empty),
                    EmailAddress = obj2.ToString(),
                    RoutingType  = "SMTP",
                    MailboxType  = MailboxHelper.ConvertToMailboxType(personType).ToString()
                };
            }
            object obj3 = rawEntry[ADUserSchema.RTCSIPPrimaryUserAddress];

            if (obj3 != null)
            {
                persona.ImAddress = obj3.ToString();
            }
            return(persona);
        }
Exemple #2
0
 // Token: 0x06000D1F RID: 3359 RVA: 0x00030FD8 File Offset: 0x0002F1D8
 internal static SingleRecipientType CreateRecipientFromParticipant(Participant participant)
 {
     return(new SingleRecipientType
     {
         Mailbox = new EmailAddressWrapper(),
         Mailbox =
         {
             Name         = participant.DisplayName,
             EmailAddress = participant.EmailAddress,
             RoutingType  = participant.RoutingType,
             MailboxType  = MailboxHelper.GetMailboxType(participant.Origin, participant.RoutingType).ToString()
         }
     });
 }