private void ValidateParameters() { if (base.Fields.IsModified("FolderToReadEmailsFrom")) { this.mailboxFolder = ManageInboxRule.ResolveMailboxFolder(this.FolderToReadEmailsFrom, new DataAccessHelper.GetDataObjectDelegate(base.GetDataObject <ADUser>), new DataAccessHelper.GetDataObjectDelegate(base.GetDataObject <MailboxFolder>), base.TenantGlobalCatalogSession, base.SessionSettings, this.DataObject, new ManageInboxRule.ThrowTerminatingErrorDelegate(base.WriteError)); } }
protected override void InternalProcessRecord() { if (this.AlwaysDeleteOutlookRulesBlob.IsPresent) { InboxRuleDataProvider inboxRuleDataProvider = (InboxRuleDataProvider)base.DataSession; inboxRuleDataProvider.SetAlwaysDeleteOutlookRulesBlob(new ManageInboxRule.ThrowTerminatingErrorDelegate(base.WriteError)); } else if (!this.Force.IsPresent) { InboxRuleDataProvider inboxRuleDataProvider = (InboxRuleDataProvider)base.DataSession; inboxRuleDataProvider.ConfirmDeleteOutlookBlob = (() => base.ShouldContinue(Strings.WarningInboxRuleOutlookBlobExists)); } if (this.DataObject.FlaggedForAction != null) { InboxRuleDataProvider.CheckFlaggedAction(this.DataObject.FlaggedForAction, InboxRuleSchema.FlaggedForAction.Name, new ManageInboxRule.ThrowTerminatingErrorDelegate(base.WriteError)); } if (this.DataObject.ExceptIfFlaggedForAction != null) { InboxRuleDataProvider.CheckFlaggedAction(this.DataObject.ExceptIfFlaggedForAction, InboxRuleSchema.ExceptIfFlaggedForAction.Name, new ManageInboxRule.ThrowTerminatingErrorDelegate(base.WriteError)); } if (this.DataObject.SendTextMessageNotificationTo.Count > 0) { SmsSqmDataPointHelper.AddNotificationConfigDataPoint(SmsSqmSession.Instance, this.adUser.Id, this.adUser.LegacyExchangeDN, SMSNotificationType.Email); } ManageInboxRule.ProcessRecord(new Action(base.InternalProcessRecord), new ManageInboxRule.ThrowTerminatingErrorDelegate(base.WriteError), this.Identity); }
protected override void InternalProcessRecord() { if (this.FromMessageId != null) { if (!base.HasErrors) { this.WriteResult(this.DataObject); } } else { InboxRuleDataProvider inboxRuleDataProvider = (InboxRuleDataProvider)base.DataSession; if (this.AlwaysDeleteOutlookRulesBlob.IsPresent) { inboxRuleDataProvider.SetAlwaysDeleteOutlookRulesBlob(new ManageInboxRule.ThrowTerminatingErrorDelegate(base.WriteError)); } else if (!inboxRuleDataProvider.IsAlwaysDeleteOutlookRulesBlob()) { if (!inboxRuleDataProvider.HandleOutlookBlob(this.Force, () => base.ShouldContinue(Strings.WarningInboxRuleOutlookBlobExists))) { return; } } ManageInboxRule.ProcessRecord(new Action(base.InternalProcessRecord), new ManageInboxRule.ThrowTerminatingErrorDelegate(base.WriteError), this.Name); } if (this.DataObject.SendTextMessageNotificationTo.Count > 0) { SmsSqmDataPointHelper.AddNotificationConfigDataPoint(SmsSqmSession.Instance, this.adUser.Id, this.adUser.LegacyExchangeDN, SMSNotificationType.Email); } }
private void PrepareDataObjectFromParameters(InboxRule inboxRule) { if (base.Fields.IsModified(InboxRuleSchema.From)) { inboxRule.From = ManageInboxRule.ResolveRecipients(this.From, new DataAccessHelper.GetDataObjectDelegate(base.GetDataObject <ADRecipient>), base.TenantGlobalCatalogSession, new ManageInboxRule.ThrowTerminatingErrorDelegate(base.WriteError)); } if (base.Fields.IsModified(InboxRuleSchema.ExceptIfFrom)) { inboxRule.ExceptIfFrom = ManageInboxRule.ResolveRecipients(this.ExceptIfFrom, new DataAccessHelper.GetDataObjectDelegate(base.GetDataObject <ADRecipient>), base.TenantGlobalCatalogSession, new ManageInboxRule.ThrowTerminatingErrorDelegate(base.WriteError)); } if (base.Fields.IsModified(InboxRuleSchema.HasClassification)) { inboxRule.HasClassification = ManageInboxRule.ResolveMessageClassifications(this.HasClassification, this.ConfigurationSession, new ManageInboxRule.ThrowTerminatingErrorDelegate(base.WriteError)); } if (base.Fields.IsModified(InboxRuleSchema.ExceptIfHasClassification)) { inboxRule.ExceptIfHasClassification = ManageInboxRule.ResolveMessageClassifications(this.ExceptIfHasClassification, this.ConfigurationSession, new ManageInboxRule.ThrowTerminatingErrorDelegate(base.WriteError)); } if (base.Fields.IsModified(InboxRuleSchema.SentTo)) { inboxRule.SentTo = ManageInboxRule.ResolveRecipients(this.SentTo, new DataAccessHelper.GetDataObjectDelegate(base.GetDataObject <ADRecipient>), base.TenantGlobalCatalogSession, new ManageInboxRule.ThrowTerminatingErrorDelegate(base.WriteError)); } if (base.Fields.IsModified(InboxRuleSchema.ExceptIfSentTo)) { inboxRule.ExceptIfSentTo = ManageInboxRule.ResolveRecipients(this.ExceptIfSentTo, new DataAccessHelper.GetDataObjectDelegate(base.GetDataObject <ADRecipient>), base.TenantGlobalCatalogSession, new ManageInboxRule.ThrowTerminatingErrorDelegate(base.WriteError)); } if (base.Fields.IsModified(InboxRuleSchema.CopyToFolder)) { inboxRule.CopyToFolder = ManageInboxRule.ResolveMailboxFolder(this.CopyToFolder, new DataAccessHelper.GetDataObjectDelegate(base.GetDataObject <ADUser>), new DataAccessHelper.GetDataObjectDelegate(base.GetDataObject <MailboxFolder>), base.TenantGlobalCatalogSession, base.SessionSettings, this.adUser, (base.ExchangeRunspaceConfig == null) ? null : base.ExchangeRunspaceConfig.SecurityAccessToken, new ManageInboxRule.ThrowTerminatingErrorDelegate(base.WriteError)); } if (base.Fields.IsModified(InboxRuleSchema.ForwardAsAttachmentTo)) { inboxRule.ForwardAsAttachmentTo = ManageInboxRule.ResolveRecipients(this.ForwardAsAttachmentTo, new DataAccessHelper.GetDataObjectDelegate(base.GetDataObject <ADRecipient>), base.TenantGlobalCatalogSession, new ManageInboxRule.ThrowTerminatingErrorDelegate(base.WriteError)); } if (base.Fields.IsModified(InboxRuleSchema.ForwardTo)) { inboxRule.ForwardTo = ManageInboxRule.ResolveRecipients(this.ForwardTo, new DataAccessHelper.GetDataObjectDelegate(base.GetDataObject <ADRecipient>), base.TenantGlobalCatalogSession, new ManageInboxRule.ThrowTerminatingErrorDelegate(base.WriteError)); } if (base.Fields.IsModified(InboxRuleSchema.MoveToFolder)) { inboxRule.MoveToFolder = ManageInboxRule.ResolveMailboxFolder(this.MoveToFolder, new DataAccessHelper.GetDataObjectDelegate(base.GetDataObject <ADUser>), new DataAccessHelper.GetDataObjectDelegate(base.GetDataObject <MailboxFolder>), base.TenantGlobalCatalogSession, base.SessionSettings, this.adUser, (base.ExchangeRunspaceConfig == null) ? null : base.ExchangeRunspaceConfig.SecurityAccessToken, new ManageInboxRule.ThrowTerminatingErrorDelegate(base.WriteError)); } if (base.Fields.IsModified(InboxRuleSchema.RedirectTo)) { inboxRule.RedirectTo = ManageInboxRule.ResolveRecipients(this.RedirectTo, new DataAccessHelper.GetDataObjectDelegate(base.GetDataObject <ADRecipient>), base.TenantGlobalCatalogSession, new ManageInboxRule.ThrowTerminatingErrorDelegate(base.WriteError)); } if (base.Fields.IsModified(InboxRuleSchema.FromSubscription)) { inboxRule.FromSubscription = ManageInboxRule.ResolveSubscriptions(this.FromSubscription, this.adUser, new ManageInboxRule.ThrowTerminatingErrorDelegate(base.WriteError)); } if (base.Fields.IsModified(InboxRuleSchema.ExceptIfFromSubscription)) { inboxRule.ExceptIfFromSubscription = ManageInboxRule.ResolveSubscriptions(this.ExceptIfFromSubscription, this.adUser, new ManageInboxRule.ThrowTerminatingErrorDelegate(base.WriteError)); } }
protected override void InternalProcessRecord() { InboxRuleDataProvider inboxRuleDataProvider = (InboxRuleDataProvider)base.DataSession; if (this.AlwaysDeleteOutlookRulesBlob.IsPresent) { inboxRuleDataProvider.SetAlwaysDeleteOutlookRulesBlob(new ManageInboxRule.ThrowTerminatingErrorDelegate(base.WriteError)); } else if (!inboxRuleDataProvider.IsAlwaysDeleteOutlookRulesBlob() && !inboxRuleDataProvider.HandleOutlookBlob(this.Force, () => base.ShouldContinue(Strings.WarningInboxRuleOutlookBlobExists))) { return; } ManageInboxRule.ProcessRecord(new Action(base.InternalProcessRecord), new ManageInboxRule.ThrowTerminatingErrorDelegate(base.WriteError), this.Identity); }
protected override void Dispose(bool disposing) { base.Dispose(disposing); ManageInboxRule.CleanupInboxRuleDataProvider(base.DataSession); GC.SuppressFinalize(this); }
protected override void InternalStateReset() { ManageInboxRule.CleanupInboxRuleDataProvider(base.DataSession); base.InternalStateReset(); }
protected override void InternalProcessRecord() { ManageInboxRule.ProcessRecord(new Action(base.InternalProcessRecord), new ManageInboxRule.ThrowTerminatingErrorDelegate(base.WriteError), this.Identity); }