public RemoveBuddy(CallContext callContext, InstantMessageBuddy instantMessageBuddy, ItemId personId) : base(callContext) { WcfServiceCommandBase.ThrowIfNull(instantMessageBuddy, "instantMessageBuddy", "RemoveBuddy"); WcfServiceCommandBase.ThrowIfNull(personId, "personId", "RemoveBuddy"); this.instantMessageBuddy = instantMessageBuddy; this.personId = IdConverter.EwsIdToPersonId(personId.Id); }
// Token: 0x06001B88 RID: 7048 RVA: 0x000699B0 File Offset: 0x00067BB0 internal bool Execute() { StoreObjectId defaultFolderId = this.session.GetDefaultFolderId(DefaultFolderType.QuickContacts); PersonId personId = IdConverter.EwsIdToPersonId(this.personaId.GetId()); AllPersonContactsEnumerator allPersonContactsEnumerator = AllPersonContactsEnumerator.Create(this.session, personId, RemoveFavorite.ContactProperties); ExTraceGlobals.RemoveFavoriteTracer.TraceDebug((long)this.GetHashCode(), "Processing contacts."); int num = 0; foreach (IStorePropertyBag storePropertyBag in allPersonContactsEnumerator) { byte[] valueOrDefault = storePropertyBag.GetValueOrDefault <byte[]>(StoreObjectSchema.ParentEntryId, null); StoreObjectId objA = StoreObjectId.FromProviderSpecificIdOrNull(valueOrDefault); if (object.Equals(objA, defaultFolderId)) { num++; VersionedId valueOrDefault2 = storePropertyBag.GetValueOrDefault <VersionedId>(ItemSchema.Id, null); if (valueOrDefault2 != null) { StoreId objectId = valueOrDefault2.ObjectId; this.utilities.RemoveContactFromGroup(objectId, this.favoritesPdlId); this.UnsetIsFavoriteFlagIfContactExists(objectId); } } } this.SetLogValue(RemoveFavoriteMetadata.NumberOfContacts, num); if (num == 0) { ExTraceGlobals.RemoveFavoriteTracer.TraceDebug <ItemId>((long)this.GetHashCode(), "No contacts found with personId: {0}", this.personaId); } return(true); }
// 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); } }
// 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); }
private GetGroupResponse GetPDLData() { GetGroupResponse getGroupResponse = new GetGroupResponse(); MailboxSession mailboxIdentityMailboxSession = base.CallContext.SessionCache.GetMailboxIdentityMailboxSession(); ItemId sourceId = this.itemId; IdAndSession idAndSession = null; if (this.parentFolderid != null && this.parentFolderid.BaseFolderId != null) { IdAndSession idAndSession2 = base.GetIdAndSession(this.parentFolderid.BaseFolderId); if (idAndSession2 != null && idAndSession2.Session.IsPublicFolderSession) { idAndSession = idAndSession2; } } if (IdConverter.EwsIdIsConversationId(this.itemId.Id)) { try { Persona persona; if (idAndSession != null) { persona = Persona.LoadFromPersonaId(idAndSession.Session, null, this.itemId, Persona.FullPersonaShape, null, idAndSession.Id); } else { persona = Persona.LoadFromPersonIdWithGalAggregation(mailboxIdentityMailboxSession, IdConverter.EwsIdToPersonId(this.itemId.Id), Persona.FullPersonaShape, null); } if (persona.Attributions.Length > 0) { sourceId = persona.Attributions[0].SourceId; for (int i = 1; i < persona.Attributions.Length; i++) { StoreId storeId = IdConverter.EwsIdToMessageStoreObjectId(persona.Attributions[i].SourceId.Id); using (Item item = Item.Bind(mailboxIdentityMailboxSession, storeId, new PropertyDefinition[] { ContactSchema.PersonId })) { item.OpenAsReadWrite(); item[ContactSchema.PersonId] = PersonId.CreateNew(); item.Save(SaveMode.NoConflictResolution); } } RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(RequestDetailsLogger.Current, "UnlinkDupedPDLs", "Success"); } else { ExTraceGlobals.GetGroupTracer.TraceError((long)this.hashCode, "ItemId is PersonaId but Persona has no linked contacts (attributions array is empty)."); RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(RequestDetailsLogger.Current, "UnlinkDupedPDLs", "Skipped"); } } catch (LocalizedException arg) { ExTraceGlobals.GetGroupTracer.TraceError <LocalizedException>((long)this.hashCode, "Failed to unlink PDLs: {0}", arg); RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(RequestDetailsLogger.Current, "UnlinkDupedPDLs", "Failed"); } } IdAndSession idAndSession3 = base.IdConverter.ConvertItemIdToIdAndSessionReadOnly(sourceId); StoreSession storeSession; if (idAndSession != null) { storeSession = idAndSession.Session; } else { storeSession = ((idAndSession3.Session as MailboxSession) ?? base.CallContext.SessionCache.GetMailboxIdentityMailboxSession()); } using (DistributionList distributionList = DistributionList.Bind(storeSession, idAndSession3.Id)) { if (distributionList == null) { this.WriteDebugTrace("No PDL was found"); return(getGroupResponse); } PersonId personId = (PersonId)distributionList[ContactSchema.PersonId]; getGroupResponse.PersonaId = IdConverter.PersonaIdFromPersonId(storeSession.MailboxGuid, personId); if (!distributionList.GetValueOrDefault <bool>(ItemSchema.ConversationIndexTracking, false)) { try { distributionList.OpenAsReadWrite(); distributionList[ItemSchema.ConversationIndexTracking] = true; distributionList.Save(SaveMode.NoConflictResolution); RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(RequestDetailsLogger.Current, "SetConversationIndexTracking", "Success"); } catch (LocalizedException arg2) { ExTraceGlobals.GetGroupTracer.TraceError <LocalizedException>((long)this.hashCode, "Failed to set ConversationIndexTracking on PDL: {0}", arg2); RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(RequestDetailsLogger.Current, "SetConversationIndexTracking", "Failed"); } } if (!this.IsMembersInResultSet) { return(getGroupResponse); } int count = distributionList.Count; getGroupResponse.MembersCount = count; this.WriteDebugTrace("Total PDL members count is " + count); if (this.paging.Offset < 0 || count <= this.paging.Offset) { this.WriteDebugTrace(string.Format("Provided offset is out of range - members count is {0}, offset is {1}.", count, this.paging.Offset)); return(getGroupResponse); } distributionList.Sort(this.PDlMembersComparer); List <Persona> list = new List <Persona>(); List <string> list2 = new List <string>(); Dictionary <string, int> dictionary = new Dictionary <string, int>(); int num = Math.Min(count, this.paging.Offset + this.paging.MaxRows); for (int j = this.paging.Offset; j < num; j++) { DistributionListMember distributionListMember = distributionList[j]; if (distributionListMember.Participant == null) { if (num < count) { num++; } getGroupResponse.MembersCount--; } else { bool flag = false; Persona persona2 = GetGroupCommand.CreatePersonaFromDistributionListMember(mailboxIdentityMailboxSession, distributionListMember, out flag); if (flag) { list2.Add(persona2.EmailAddress.EmailAddress); dictionary.Add(persona2.EmailAddress.EmailAddress, list.Count); } list.Add(persona2); } } if (list2.Count > 0) { IRecipientSession galscopedADRecipientSession = base.CallContext.ADRecipientSessionContext.GetGALScopedADRecipientSession(base.CallContext.EffectiveCaller.ClientSecurityContext); Result <ADRawEntry>[] array = galscopedADRecipientSession.FindByLegacyExchangeDNs(list2.ToArray(), new PropertyDefinition[] { ADObjectSchema.Id, ADRecipientSchema.DisplayName, ADRecipientSchema.PrimarySmtpAddress, ADRecipientSchema.RecipientType, ADRecipientSchema.RecipientTypeDetails, ADRecipientSchema.LegacyExchangeDN }); foreach (Result <ADRawEntry> result in array) { if (result.Data != null) { Persona personaFromADObject = GetGroupCommand.GetPersonaFromADObject(result.Data); string key = result.Data[ADRecipientSchema.LegacyExchangeDN] as string; int num2; if (dictionary.ContainsKey(key) && dictionary.TryGetValue(key, out num2) && num2 >= 0) { list[num2] = personaFromADObject; } } } } list.Sort(this.PersonaComparer); Persona[] array3 = new Persona[list.Count]; list.CopyTo(0, array3, 0, list.Count); getGroupResponse.Members = array3; this.WriteDebugTrace("PDL members count loaded in the response is " + getGroupResponse.Members.Length); } return(getGroupResponse); }