public IMailboxBuilder <UserMailbox> BuildFromDirectory(ADRawEntry rawEntry) { ArgumentValidator.ThrowIfNull("rawEntry", rawEntry); this.Mailbox.ADObjectId = rawEntry.Id; this.Mailbox.Alias = (rawEntry[ADRecipientSchema.Alias] as string); this.Mailbox.DisplayName = (rawEntry[ADRecipientSchema.DisplayName] as string); this.Mailbox.ImAddress = ADPersonToContactConverter.GetSipUri(rawEntry); this.Mailbox.IsOwner = this.owners.Contains(rawEntry.Id); this.Mailbox.SmtpAddress = (SmtpAddress)rawEntry[ADRecipientSchema.PrimarySmtpAddress]; this.Mailbox.Title = (rawEntry[ADOrgPersonSchema.Title] as string); return(this); }
protected override void DoLoad(OwaIdentity logonIdentity, OwaIdentity mailboxIdentity, UserContextStatistics stats) { HttpContext httpContext = HttpContext.Current; RequestDetailsLogger current = RequestDetailsLoggerBase <RequestDetailsLogger> .GetCurrent(httpContext); RequestDetailsLogger.LogEvent(current, OwaServerLogger.LoggerData.UserContextLoadBegin); base.DoLoad(logonIdentity, mailboxIdentity, stats); RequestDetailsLogger.LogEvent(current, OwaServerLogger.LoggerData.GetOWAMiniRecipientBegin); Stopwatch stopwatch = Stopwatch.StartNew(); OWAMiniRecipient owaminiRecipient = base.LogonIdentity.GetOWAMiniRecipient(); stats.MiniRecipientCreationTime = (int)stopwatch.ElapsedMilliseconds; RequestDetailsLogger.LogEvent(current, OwaServerLogger.LoggerData.GetOWAMiniRecipientEnd); base.LogTrace("UserContext.Load", "GetOWAMiniRecipient finished"); this.sipUri = ADPersonToContactConverter.GetSipUri(owaminiRecipient); stopwatch.Restart(); this.IsBposUser = CapabilityHelper.HasBposSKUCapability(owaminiRecipient.PersistedCapabilities); stats.SKUCapabilityTestTime = (int)stopwatch.ElapsedMilliseconds; base.LogTrace("UserContext.Load", "HasBposSKUCapability finished"); if (Globals.IsFirstReleaseFlightingEnabled) { this.CreateFeatureManagerFactory(owaminiRecipient); } else { RecipientTypeDetails recipientTypeDetails = base.ExchangePrincipal.RecipientTypeDetails; this.featuresManagerFactory = new FeaturesManagerFactory(owaminiRecipient, new ConfigurationContext(this), new ScopeFlightsSettingsProvider(), (VariantConfigurationSnapshot c) => new FeaturesStateOverride(c, recipientTypeDetails), string.Empty, false); } this.BposSkuCapability = string.Empty; if (this.IsBposUser) { Capability?skucapability = CapabilityHelper.GetSKUCapability(owaminiRecipient.PersistedCapabilities); if (skucapability != null) { this.BposSkuCapability = skucapability.ToString(); } } this.LogEventCommonData = new LogEventCommonData(this); this.IsGroupUserContext = (base.IsExplicitLogon && base.ExchangePrincipal.RecipientTypeDetails == RecipientTypeDetails.GroupMailbox); RequestDetailsLogger.LogEvent(current, OwaServerLogger.LoggerData.UserContextLoadEnd); }
internal static string GetSipUri(string emailAddress, IUserContext userContext) { IRecipientSession recipientSession = InstantMessageUtilities.CreateADRecipientSession(Culture.GetUserCulture().LCID, true, ConsistencyMode.IgnoreInvalid, true, userContext.ExchangePrincipal, false, userContext.MailboxIdentity.GetOWAMiniRecipient().QueryBaseDN); try { SmtpProxyAddress proxyAddress = new SmtpProxyAddress(emailAddress, true); ADRecipient adrecipient = recipientSession.FindByProxyAddress(proxyAddress); if (adrecipient != null) { string sipUri = ADPersonToContactConverter.GetSipUri(adrecipient); Microsoft.Exchange.Diagnostics.Components.Clients.ExTraceGlobals.InstantMessagingTracer.TraceDebug <string, string>(0L, "SIPUri for {0}: {1}", emailAddress, sipUri); return(sipUri); } } catch (NonUniqueRecipientException ex) { Microsoft.Exchange.Diagnostics.Components.Clients.ExTraceGlobals.InstantMessagingTracer.TraceError <string>(0L, "Failed to get unique recipient: Error: {0}", ex.Message); } Microsoft.Exchange.Diagnostics.Components.Clients.ExTraceGlobals.InstantMessagingTracer.TraceError <string>(0L, "Failed to get SIP Address for: {0}", emailAddress); return(null); }