예제 #1
0
        public MappedPrincipal(ADRawEntry entry)
        {
            this.ObjectGuid = entry.Id.ObjectGuid;
            this.ObjectDN   = entry.Id.DistinguishedName;
            object[] properties = entry.GetProperties(MappedPrincipal.PrincipalProperties);
            this.MailboxGuid = ((properties[0] is Guid) ? ((Guid)properties[0]) : Guid.Empty);
            this.LegacyDN    = (properties[1] as string);
            this.ObjectSid   = (properties[2] as SecurityIdentifier);
            ProxyAddressCollection proxyAddressCollection = properties[3] as ProxyAddressCollection;

            this.ProxyAddresses = ((proxyAddressCollection != null) ? proxyAddressCollection.ToStringArray() : null);
            SecurityIdentifier securityIdentifier = properties[4] as SecurityIdentifier;

            if (securityIdentifier != null && !securityIdentifier.IsWellKnown(WellKnownSidType.SelfSid))
            {
                this.ObjectSid = securityIdentifier;
            }
            this.Alias       = (properties[5] as string);
            this.DisplayName = (properties[6] as string);
        }
예제 #2
0
        // Token: 0x06001AB4 RID: 6836 RVA: 0x00064A9C File Offset: 0x00062C9C
        protected override GetPersonaNotesResponse InternalExecute()
        {
            GetPersonaNotesResponse getPersonaNotesResponse = new GetPersonaNotesResponse();
            ADObjectId adobjectId = null;
            PersonId   personId   = null;

            if (string.IsNullOrEmpty(this.personaId))
            {
                if (this.emailAddress == null || string.IsNullOrEmpty(this.emailAddress.EmailAddress))
                {
                    this.WriteTrace("Valid PersonaId or EmailAddress needs to be specified.", new object[0]);
                    return(getPersonaNotesResponse);
                }
                string text = this.emailAddress.EmailAddress;
                personId = Person.FindPersonIdByEmailAddress(base.CallContext.SessionCache.GetMailboxIdentityMailboxSession(), new XSOFactory(), text);
                if (personId == null)
                {
                    ProxyAddress proxyAddress = null;
                    if (!ProxyAddress.TryParse(text, out proxyAddress))
                    {
                        this.WriteTrace("EmailAddress is not valid - {0}", new object[]
                        {
                            text
                        });
                        return(getPersonaNotesResponse);
                    }
                    PropertyDefinition[] array = new PropertyDefinition[]
                    {
                        ADObjectSchema.Id
                    };
                    ADRawEntry adrawEntry = this.adRecipientSession.FindByProxyAddress(proxyAddress, array);
                    if (adrawEntry == null)
                    {
                        this.WriteTrace("Contact not found with specified EmailAddress - {0}", new object[]
                        {
                            text
                        });
                        return(getPersonaNotesResponse);
                    }
                    object[] properties = adrawEntry.GetProperties(array);
                    if (properties == null || properties.Length == 0)
                    {
                        this.WriteTrace("Contact not found with specified EmailAddress - {0}", new object[]
                        {
                            text
                        });
                        return(getPersonaNotesResponse);
                    }
                    adobjectId = (ADObjectId)properties[0];
                }
            }
            else if (IdConverter.EwsIdIsActiveDirectoryObject(this.personaId))
            {
                adobjectId = IdConverter.EwsIdToADObjectId(this.personaId);
            }
            else
            {
                personId = IdConverter.EwsIdToPersonId(this.personaId);
            }
            List <BodyContentAttributedValue> list = null;

            if (adobjectId != null)
            {
                list = this.GetNotesFromActiveDirectory(adobjectId);
            }
            else if (personId != null)
            {
                list = this.GetNotesFromStore(personId);
            }
            if (list != null && list.Count > 0)
            {
                getPersonaNotesResponse.PersonaWithNotes = new Persona
                {
                    PersonaId = new ItemId(),
                    PersonaId =
                    {
                        Id = this.personaId
                    },
                    Bodies = list.ToArray()
                };
            }
            return(getPersonaNotesResponse);
        }
예제 #3
0
        // Token: 0x0600100A RID: 4106 RVA: 0x0005DCD0 File Offset: 0x0005BED0
        private void WriteADEntry(XmlWriter entryWriter, ADRawEntry entry)
        {
            base.Logger.TraceDebug(this, "Entering ADCrawler.WriteADEntry", new object[0]);
            object[]             properties           = entry.GetProperties(GrammarRecipientHelper.LookupProperties);
            RecipientTypeDetails recipientTypeDetails = (RecipientTypeDetails)properties[5];
            bool flag = this.ShouldAcceptADEntry(recipientTypeDetails);

            if (flag)
            {
                entryWriter.WriteStartElement("ADEntry");
                int i = 0;
                while (i < properties.Length)
                {
                    string text = string.Empty;
                    if (properties[i] == null)
                    {
                        base.Logger.TraceDebug(this, "ADEntry - Property='{0}', Value is null", new object[]
                        {
                            GrammarRecipientHelper.LookupProperties[i].Name
                        });
                        goto IL_22D;
                    }
                    if (GrammarRecipientHelper.LookupProperties[i] == ADRecipientSchema.UMRecipientDialPlanId)
                    {
                        ADObjectId adobjectId = properties[i] as ADObjectId;
                        text = adobjectId.ObjectGuid.ToString();
                        goto IL_22D;
                    }
                    if (GrammarRecipientHelper.LookupProperties[i] == ADRecipientSchema.AddressListMembership)
                    {
                        ADMultiValuedProperty <ADObjectId> admultiValuedProperty = properties[i] as ADMultiValuedProperty <ADObjectId>;
                        List <string> list = new List <string>(admultiValuedProperty.Count);
                        foreach (ADObjectId adobjectId2 in admultiValuedProperty)
                        {
                            list.Add(adobjectId2.ObjectGuid.ToString());
                        }
                        text = string.Join(",", list.ToArray());
                        goto IL_22D;
                    }
                    if (GrammarRecipientHelper.LookupProperties[i] == ADRecipientSchema.DisplayName || GrammarRecipientHelper.LookupProperties[i] == ADRecipientSchema.PhoneticDisplayName || GrammarRecipientHelper.LookupProperties[i] == ADObjectSchema.DistinguishedName)
                    {
                        text = GrammarRecipientHelper.GetSanitizedDisplayNameForXMLEntry(properties[i].ToString());
                        goto IL_22D;
                    }
                    if (GrammarRecipientHelper.LookupProperties[i] == ADRecipientSchema.PrimarySmtpAddress || GrammarRecipientHelper.LookupProperties[i] == ADObjectSchema.Guid || GrammarRecipientHelper.LookupProperties[i] == ADRecipientSchema.RecipientType || GrammarRecipientHelper.LookupProperties[i] == ADObjectSchema.WhenChangedUTC)
                    {
                        text = properties[i].ToString();
                        goto IL_22D;
                    }
                    if (GrammarRecipientHelper.LookupProperties[i] != ADRecipientSchema.RecipientTypeDetails)
                    {
                        ExAssert.RetailAssert(false, "Invalid lookup property '{0}'", new object[]
                        {
                            GrammarRecipientHelper.LookupProperties[i].Name
                        });
                        goto IL_22D;
                    }
                    base.Logger.TraceDebug(this, "Skipping property='{0}'", new object[]
                    {
                        GrammarRecipientHelper.LookupProperties[i].Name
                    });
IL_27E:
                    i++;
                    continue;
IL_22D:
                    base.Logger.TraceDebug(this, "ADEntry -  Property='{0}', Value='{1}'", new object[]
                    {
                        GrammarRecipientHelper.LookupProperties[i].Name,
                        text
                    });
                    entryWriter.WriteStartAttribute(GrammarRecipientHelper.LookupProperties[i].Name);
                    entryWriter.WriteString(text);
                    entryWriter.WriteEndAttribute();
                    goto IL_27E;
                }
                entryWriter.WriteEndElement();
            }
        }