public static bool ShouldSetupNotificationManagerForUser(MailboxSession mailboxSession, UserContext userContext) { if (mailboxSession != null && mailboxSession.MailboxOwner != null && !mailboxSession.MailboxOwner.MailboxInfo.MailboxGuid.Equals(Guid.Empty) && !mailboxSession.MailboxOwner.MailboxInfo.MailboxDatabase.IsNullOrEmpty() && !string.IsNullOrEmpty(mailboxSession.MailboxOwner.MailboxInfo.Location.ServerFqdn)) { return(true); } ExTraceGlobals.ConnectedAccountsTracer.TraceDebug((long)userContext.GetHashCode(), "UserContext.InvokeConnectedAccountsSync::RequiredMailBoxSessionPropertiesNotSet, skip setting up the ConnectedAccountsNotificationManager."); return(false); }
public static TxSyncConnectedAccountsNotificationManager Create(MailboxSession mailboxSession, UserContext userContext) { if (ConnectedAccountsNotificationManagerBase.ShouldSetupNotificationManagerForUser(mailboxSession, userContext) && TxSyncConnectedAccountsNotificationManager.ShouldSetupNotificationManagerForUser(mailboxSession)) { IExchangePrincipal mailboxOwner = mailboxSession.MailboxOwner; ExTraceGlobals.ConnectedAccountsTracer.TraceDebug <Guid, Guid, string>((long)userContext.GetHashCode(), "TxSyncConnectedAccountsNotificationManager.Create::Setting up ConnectedAccountsNotificationManager for User (MailboxGuid:{0}, MdbGuid:{1}, ServerFullyQualifiedDomainName:{2}).", mailboxOwner.MailboxInfo.MailboxGuid, mailboxOwner.MailboxInfo.GetDatabaseGuid(), mailboxOwner.MailboxInfo.Location.ServerFqdn); return(new TxSyncConnectedAccountsNotificationManager(mailboxOwner.MailboxInfo.MailboxGuid, mailboxOwner.MailboxInfo.GetDatabaseGuid(), mailboxOwner.MailboxInfo.Location.ServerFqdn)); } return(null); }