// Token: 0x06001AA0 RID: 6816 RVA: 0x00063DD4 File Offset: 0x00061FD4
        public GetPersonaPhoto(CallContext callContext, string personIdParam, string adObjectIdParam, string email, string singleSourceId, Microsoft.Exchange.Services.Core.Types.UserPhotoSize size) : base(callContext)
        {
            if (callContext == null)
            {
                throw new ArgumentNullException("callContext");
            }
            this.InitializeRequestTrackingInformation();
            this.InitializeTracers();
            OwsLogRegistry.Register("GetPersonaPhoto", typeof(PhotosLoggingMetadata), new Type[0]);
            this.perfLogger      = new PhotoRequestPerformanceLogger(base.CallContext.ProtocolLog, this.tracer);
            this.responseContext = callContext.CreateWebResponseContext();
            this.size            = size;
            this.tracer.TraceDebug <Microsoft.Exchange.Services.Core.Types.UserPhotoSize>((long)this.GetHashCode(), "size = {0}", this.size);
            this.email = email;
            this.tracer.TraceDebug <string>((long)this.GetHashCode(), "email = {0}", this.email);
            if (!string.IsNullOrEmpty(personIdParam))
            {
                try
                {
                    if (IdConverter.EwsIdIsConversationId(personIdParam))
                    {
                        this.personId = IdConverter.EwsIdToPersonId(personIdParam);
                        this.tracer.TraceDebug <PersonId>((long)this.GetHashCode(), "personId = {0}", this.personId);
                    }
                }
                catch (InvalidStoreIdException arg)
                {
                    this.tracer.TraceError <string, InvalidStoreIdException>((long)this.GetHashCode(), "Exception: InvalidStoreIdException. personIdParam = {0}. Exception: {1}", personIdParam, arg);
                }
            }
            Guid empty = Guid.Empty;

            if (!string.IsNullOrEmpty(adObjectIdParam) && Guid.TryParse(adObjectIdParam, out empty))
            {
                this.adObjectId = new ADObjectId(empty);
                this.tracer.TraceDebug <ADObjectId>((long)this.GetHashCode(), "adObjectId = {0}", this.adObjectId);
            }
            if (!string.IsNullOrEmpty(singleSourceId))
            {
                if (IdConverter.EwsIdIsActiveDirectoryObject(singleSourceId))
                {
                    this.adObjectId = IdConverter.EwsIdToADObjectId(singleSourceId);
                    this.tracer.TraceDebug <ADObjectId>((long)this.GetHashCode(), "adObjectId = {0}", this.adObjectId);
                    return;
                }
                this.contactId = IdConverter.EwsIdToMessageStoreObjectId(singleSourceId);
                this.tracer.TraceDebug <StoreObjectId>((long)this.GetHashCode(), "contactId = {0}", this.contactId);
            }
        }
Beispiel #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);
        }