public SendAddressDataProvider(ExchangePrincipal userPrincipal, string mailboxIdParameterString) { SyncUtilities.ThrowIfArgumentNull("userPrincipal", userPrincipal); SyncUtilities.ThrowIfArgumentNullOrEmpty("mailboxIdParameterString", mailboxIdParameterString); this.userPrincipal = userPrincipal; this.mailboxIdParameterString = mailboxIdParameterString; }
internal static void ValidateIncomingServerLength(string incomingServer, Task.TaskErrorLoggingDelegate taskErrorLoggingDelegate) { SyncUtilities.ThrowIfArgumentNullOrEmpty("incomingServer", incomingServer); SyncUtilities.ThrowIfArgumentNull("taskErrorLoggingDelegate", taskErrorLoggingDelegate); if (incomingServer.Length > SyncUtilities.MaximumFqdnLength) { taskErrorLoggingDelegate(new IncomingServerTooLongException(), ErrorCategory.InvalidArgument, null); } }
internal static void ValidateUnicodeInfoOnUserNameAndPassword(string userName, SecureString password, Task.TaskErrorLoggingDelegate taskErrorLoggingDelegate) { SyncUtilities.ThrowIfArgumentNullOrEmpty("userName", userName); SyncUtilities.ThrowIfArgumentNull("password", password); SyncUtilities.ThrowIfArgumentNull("taskErrorLoggingDelegate", taskErrorLoggingDelegate); if (SyncUtilities.HasUnicodeCharacters(userName) || (password.Length > 0 && SyncUtilities.HasUnicodeCharacters(password))) { taskErrorLoggingDelegate(new InvalidOperationException(Strings.InvalidUnicodeCharacterUsage), ErrorCategory.InvalidArgument, null); } }
internal static IRecipientSession VerifyIsWithinWriteScopes(IRecipientSession recipientSession, ADUser adUser, Task.TaskErrorLoggingDelegate taskErrorLoggingDelegate) { SyncUtilities.ThrowIfArgumentNull("recipientSession", recipientSession); SyncUtilities.ThrowIfArgumentNull("adUser", adUser); SyncUtilities.ThrowIfArgumentNull("taskErrorLoggingDelegate", taskErrorLoggingDelegate); IRecipientSession recipientSession2 = (IRecipientSession)TaskHelper.UnderscopeSessionToOrganization(recipientSession, adUser.OrganizationId, true); ADScopeException ex; if (!recipientSession2.TryVerifyIsWithinScopes(adUser, true, out ex)) { taskErrorLoggingDelegate(new InvalidOperationException(Strings.ErrorCannotChangeMailboxOutOfWriteScope(adUser.Identity.ToString(), (ex == null) ? string.Empty : ex.Message), ex), ErrorCategory.InvalidOperation, adUser.Identity); } return(recipientSession2); }
public virtual void CheckUpdateSubscriptionConstraints(PimAggregationSubscription updatedSubscription, IList <AggregationSubscription> subscriptions) { SyncUtilities.ThrowIfArgumentNull("UpdatedSubscription", updatedSubscription); if (subscriptions == null) { return; } foreach (AggregationSubscription aggregationSubscription in subscriptions) { if (!aggregationSubscription.SubscriptionGuid.Equals(updatedSubscription.SubscriptionGuid)) { this.CheckUpdateSubscriptionConstraints(updatedSubscription, aggregationSubscription as PimAggregationSubscription); } } }
private static bool ShouldSetupNotificationManagerForUser(MailboxSession userMailboxSession) { SyncUtilities.ThrowIfArgumentNull("userMailboxSession", userMailboxSession); bool result; try { bool flag = SubscriptionManager.DoesUserHasAnyActiveConnectedAccounts(userMailboxSession, AggregationSubscriptionType.AllEMail); result = flag; } catch (LocalizedException arg) { ExTraceGlobals.ConnectedAccountsTracer.TraceError <Guid, SmtpAddress, LocalizedException>((long)userMailboxSession.GetHashCode(), "DoesUserHasActiveConnectedAccounts failed for User (MailboxGuid:{0}, PrimarySmtpAddress:{1}), with error:{2}. We will assume that user has active connected accounts.", userMailboxSession.MailboxGuid, userMailboxSession.MailboxOwner.MailboxInfo.PrimarySmtpAddress, arg); result = true; } return(result); }
private void PostSaveSendAsStateProcessing(PimAggregationSubscription subscription, DelayedEmailSender delayedEmailSender, MailboxSession mailboxSession) { SyncUtilities.ThrowIfArgumentNull("delayedEmailSender", delayedEmailSender); if (subscription.SendAsState == SendAsState.Enabled) { AggregationTaskUtils.EnableAlwaysShowFrom(this.primaryExchangePrincipal); } if (!delayedEmailSender.SendAttempted) { return; } IEmailSender emailSender = delayedEmailSender.TriggerDelayedSend(); SendAsManager sendAsManager = new SendAsManager(); sendAsManager.UpdateSubscriptionWithDiagnostics(subscription, emailSender); SubscriptionManager.SetSubscription(mailboxSession, subscription); }
public void CheckNewSubscriptionConstraints(PimAggregationSubscription newSubscription, IList <AggregationSubscription> subscriptions, int maxSubscriptionAllowed) { SyncUtilities.ThrowIfArgumentNull("newSubscription", newSubscription); if (subscriptions == null) { return; } this.CheckUpdateSubscriptionConstraints(newSubscription, subscriptions); int num = 0; foreach (AggregationSubscription aggregationSubscription in subscriptions) { if (aggregationSubscription.AggregationType == newSubscription.AggregationType) { num++; } } this.CheckIfCanCreateNewSubscriptionConstraint(newSubscription, maxSubscriptionAllowed, num); }
protected ConnectedAccountsNotificationManagerBase(Guid userMailboxGuid, Guid userMdbGuid, string userMailboxServerFQDN, IConnectedAccountsConfiguration configuration, ISyncNowNotificationClient notificationClient, Func <TimerCallback, object, TimeSpan, TimeSpan, IGuardedTimer> createGuardedTimer) { SyncUtilities.ThrowIfGuidEmpty("userMailboxGuid", userMailboxGuid); SyncUtilities.ThrowIfGuidEmpty("userMdbGuid", userMdbGuid); SyncUtilities.ThrowIfArgumentNullOrEmpty("userMailboxServerFQDN", userMailboxServerFQDN); SyncUtilities.ThrowIfArgumentNull("configuration", configuration); SyncUtilities.ThrowIfArgumentNull("notificationClient", notificationClient); SyncUtilities.ThrowIfArgumentNull("createGuardedTimer", createGuardedTimer); this.configuration = configuration; this.notificationClient = notificationClient; this.userMailboxGuid = userMailboxGuid; this.userMdbGuid = userMdbGuid; this.userMailboxServerFQDN = userMailboxServerFQDN; if (this.configuration.PeriodicSyncNowEnabled) { ExTraceGlobals.ConnectedAccountsTracer.TraceDebug <Guid, TimeSpan>((long)this.GetHashCode(), "ConnectedAccountsNotificationManager::Setting up periodicSyncNowTimer for User:{0}, PeriodicSyncNowInterval:{1}", this.userMdbGuid, this.configuration.PeriodicSyncNowInterval); this.periodicSyncNowTimer = createGuardedTimer(new TimerCallback(this.SendPeriodicSyncNowRequest), null, this.configuration.PeriodicSyncNowInterval, this.configuration.PeriodicSyncNowInterval); } }
private static bool ShouldSetupNotificationManagerForUser(MailboxSession userMailboxSession) { SyncUtilities.ThrowIfArgumentNull("userMailboxSession", userMailboxSession); try { IExchangePrincipal mailboxOwner = userMailboxSession.MailboxOwner; ADUser aduser = DirectoryHelper.ReadADRecipient(mailboxOwner.MailboxInfo.MailboxGuid, mailboxOwner.MailboxInfo.IsArchive, userMailboxSession.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid)) as ADUser; if (aduser != null) { AggregatedAccountHelper aggregatedAccountHelper = new AggregatedAccountHelper(userMailboxSession, aduser); List <AggregatedAccountInfo> listOfAccounts = aggregatedAccountHelper.GetListOfAccounts(); if (listOfAccounts != null) { return(listOfAccounts.Count > 0); } } } catch (LocalizedException arg) { ExTraceGlobals.ConnectedAccountsTracer.TraceError <Guid, SmtpAddress, LocalizedException>((long)userMailboxSession.GetHashCode(), "MrsConnectedAccountsNotificationManager.ShouldSetupNotificationManagerForUser failed for User (MailboxGuid:{0}, PrimarySmtpAddress:{1}), with error:{2}. We will assume that user has active connected accounts.", userMailboxSession.MailboxGuid, userMailboxSession.MailboxOwner.MailboxInfo.PrimarySmtpAddress, arg); } return(false); }
internal static void ProcessSendAsSpecificParameters(PimSubscriptionProxy subscriptionProxy, string validateSecret, bool resendVerification, AggregationSubscriptionDataProvider dataProvider, Task.TaskErrorLoggingDelegate taskErrorLoggingDelegate) { SyncUtilities.ThrowIfArgumentNull("subscriptionProxy", subscriptionProxy); SyncUtilities.ThrowIfArgumentNull("dataProvider", dataProvider); SyncUtilities.ThrowIfArgumentNull("taskErrorLoggingDelegate", taskErrorLoggingDelegate); SendAsManager sendAsManager = new SendAsManager(); if (validateSecret != null) { if (sendAsManager.ValidateSharedSecret(subscriptionProxy.Subscription, validateSecret)) { AggregationTaskUtils.EnableAlwaysShowFrom(dataProvider.SubscriptionExchangePrincipal); } else { taskErrorLoggingDelegate(new ValidateSecretFailureException(), (ErrorCategory)1003, subscriptionProxy); } } if (resendVerification) { IEmailSender emailSender = subscriptionProxy.Subscription.CreateEmailSenderFor(dataProvider.ADUser, dataProvider.SubscriptionExchangePrincipal); sendAsManager.ResendVerificationEmail(subscriptionProxy.Subscription, emailSender); } }
public CacheDataProvider(SubscriptionCacheAction cacheAction, ExchangePrincipal userPrincipal) { SyncUtilities.ThrowIfArgumentNull("userPrincipal", userPrincipal); this.cacheAction = cacheAction; this.userPrincipal = userPrincipal; }
public ImportContactListResult(ObjectId mbxIdentity) : base(new SimpleProviderPropertyBag()) { SyncUtilities.ThrowIfArgumentNull("mbxIdentity", mbxIdentity); this[SimpleProviderObjectSchema.Identity] = mbxIdentity; base.ResetChangeTracking(); }
internal void SetIdentity(ADObjectId userIdentity) { SyncUtilities.ThrowIfArgumentNull("userIdentity", userIdentity); this.identity = userIdentity; }