예제 #1
0
        protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            ADUser aduser = (ADUser)base.PrepareDataObject();

            aduser.BypassModerationCheck = true;
            if (base.Fields.IsModified("IntendedMailboxPlan"))
            {
                aduser.IntendedMailboxPlan = ((this.intendedMailboxPlanObject == null) ? null : this.intendedMailboxPlanObject.Id);
            }
            if (this.SmtpAndX500Addresses != null && this.SmtpAndX500Addresses.Count > 0)
            {
                aduser.EmailAddresses = SyncTaskHelper.ReplaceSmtpAndX500Addresses(this.SmtpAndX500Addresses, aduser.EmailAddresses);
            }
            if (base.Fields.IsModified("ReleaseTrack"))
            {
                aduser.ReleaseTrack = this.ReleaseTrack;
            }
            if (base.Fields.IsModified("SipAddresses"))
            {
                aduser.EmailAddresses = SyncTaskHelper.ReplaceSipAddresses(this.SipAddresses, aduser.EmailAddresses);
            }
            if (this.DataObject.IsModified(MailEnabledRecipientSchema.EmailAddresses))
            {
                aduser.EmailAddresses = SyncTaskHelper.FilterDuplicateEmailAddresses(base.TenantGlobalCatalogSession, this.DataObject.EmailAddresses, this.DataObject, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskWarningLoggingDelegate(this.WriteWarning));
            }
            TaskLogger.LogExit();
            return(aduser);
        }
예제 #2
0
        protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            ADUser aduser = (ADUser)base.PrepareDataObject();

            aduser.BypassModerationCheck = true;
            if (this.SmtpAndX500Addresses != null && this.SmtpAndX500Addresses.Count > 0)
            {
                aduser.EmailAddresses = SyncTaskHelper.ReplaceSmtpAndX500Addresses(this.SmtpAndX500Addresses, aduser.EmailAddresses);
            }
            if (base.Fields.IsModified("SipAddresses"))
            {
                aduser.EmailAddresses = SyncTaskHelper.ReplaceSipAddresses(this.SipAddresses, aduser.EmailAddresses);
            }
            if (this.DataObject != null && this.DataObject.IsModified(MailEnabledRecipientSchema.EmailAddresses))
            {
                aduser.EmailAddresses = SyncTaskHelper.FilterDuplicateEmailAddresses(base.TenantGlobalCatalogSession, this.DataObject.EmailAddresses, this.DataObject, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskWarningLoggingDelegate(this.WriteWarning));
                aduser.EmailAddresses = SyncTaskHelper.UpdateSipNameEumProxyAddress(aduser.EmailAddresses);
            }
            if (base.Fields.IsModified(SyncMailboxSchema.ReleaseTrack))
            {
                aduser.ReleaseTrack = this.ReleaseTrack;
            }
            if (base.Fields.IsModified(MailboxSchema.ArchiveGuid))
            {
                aduser.ArchiveGuid = this.ArchiveGuid;
            }
            if (this.DataObject.IsModified(SyncMailboxSchema.AccountDisabled))
            {
                SyncTaskHelper.SetExchangeAccountDisabledWithADLogon(aduser, this.DataObject.AccountDisabled);
            }
            TaskLogger.LogExit();
            return(aduser);
        }
 protected override void PrepareRecipientObject(ADGroup group)
 {
     TaskLogger.LogEnter();
     base.PrepareRecipientObject(group);
     if (base.ManagedBy == null)
     {
         MultiValuedProperty <ADObjectId> multiValuedProperty  = new MultiValuedProperty <ADObjectId>();
         RoleGroupIdParameter             roleGroupIdParameter = new RoleGroupIdParameter("Organization Management");
         ADGroup adgroup = (ADGroup)base.GetDataObject <ADGroup>(roleGroupIdParameter, base.TenantGlobalCatalogSession, null, null, new LocalizedString?(Strings.ErrorRecipientNotFound(roleGroupIdParameter.ToString())), new LocalizedString?(Strings.ErrorRecipientNotUnique(roleGroupIdParameter.ToString())), ExchangeErrorCategory.Client);
         multiValuedProperty.Add(adgroup.Id);
         group.ManagedBy = multiValuedProperty;
     }
     group.BypassModerationCheck = true;
     if (base.Fields.IsModified(ADRecipientSchema.GrantSendOnBehalfTo) && this.grantSendOnBehalfTo != null)
     {
         foreach (ADRecipient adrecipient in this.grantSendOnBehalfTo)
         {
             group.GrantSendOnBehalfTo.Add(adrecipient.Identity as ADObjectId);
         }
     }
     if (base.Fields.IsModified(MailEnabledRecipientSchema.BypassModerationFrom))
     {
         group.BypassModerationFrom = this.bypassModerationFrom;
     }
     if (base.Fields.IsModified(MailEnabledRecipientSchema.BypassModerationFromDLMembers))
     {
         group.BypassModerationFromDLMembers = this.bypassModerationFromDLMembers;
     }
     if (this.DataObject != null && this.DataObject.IsModified(ADRecipientSchema.EmailAddresses))
     {
         group.EmailAddresses = SyncTaskHelper.FilterDuplicateEmailAddresses(base.TenantGlobalCatalogSession, this.DataObject.EmailAddresses, this.DataObject, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskWarningLoggingDelegate(this.WriteWarning));
     }
     if (base.Fields.IsModified(ADRecipientSchema.AcceptMessagesOnlyFrom))
     {
         group.AcceptMessagesOnlyFrom = (from c in this.acceptMessagesOnlyFrom
                                         select c.Identity as ADObjectId).ToArray <ADObjectId>();
     }
     if (base.Fields.IsModified(ADRecipientSchema.AcceptMessagesOnlyFromDLMembers))
     {
         group.AcceptMessagesOnlyFromDLMembers = (from c in this.acceptMessagesOnlyFromDLMembers
                                                  select c.Identity as ADObjectId).ToArray <ADObjectId>();
     }
     if (base.Fields.IsModified(ADRecipientSchema.RejectMessagesFrom))
     {
         group.RejectMessagesFrom = (from c in this.rejectMessagesFrom
                                     select c.Identity as ADObjectId).ToArray <ADObjectId>();
     }
     if (base.Fields.IsModified(ADRecipientSchema.RejectMessagesFromDLMembers))
     {
         group.RejectMessagesFromDLMembers = (from c in this.rejectMessagesFromDLMembers
                                              select c.Identity as ADObjectId).ToArray <ADObjectId>();
     }
     group.ReportToOriginatorEnabled         = this.ReportToOriginatorEnabled;
     group.RequireAllSendersAreAuthenticated = this.RequireSenderAuthenticationEnabled;
     TaskLogger.LogExit();
 }
예제 #4
0
        protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            ADContact adcontact = (ADContact)base.PrepareDataObject();

            adcontact.BypassModerationCheck = true;
            if (this.SmtpAndX500Addresses != null && this.SmtpAndX500Addresses.Count > 0)
            {
                adcontact.EmailAddresses = SyncTaskHelper.ReplaceSmtpAndX500Addresses(this.SmtpAndX500Addresses, adcontact.EmailAddresses);
            }
            if (base.Fields.IsModified("SipAddresses"))
            {
                adcontact.EmailAddresses = SyncTaskHelper.ReplaceSipAddresses(this.SipAddresses, adcontact.EmailAddresses);
            }
            if (adcontact.IsModified(MailEnabledRecipientSchema.EmailAddresses))
            {
                adcontact.EmailAddresses = SyncTaskHelper.FilterDuplicateEmailAddresses(base.TenantGlobalCatalogSession, adcontact.EmailAddresses, adcontact, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskWarningLoggingDelegate(this.WriteWarning));
            }
            TaskLogger.LogExit();
            return(adcontact);
        }
예제 #5
0
 protected override void PrepareRecipientObject(ADContact contact)
 {
     TaskLogger.LogEnter();
     base.PrepareRecipientObject(contact);
     contact.BypassModerationCheck = true;
     if (base.Fields.IsModified("Manager"))
     {
         contact.Manager = ((this.manager == null) ? null : ((ADObjectId)this.manager.Identity));
     }
     if (base.Fields.IsModified(ADRecipientSchema.GrantSendOnBehalfTo) && this.grantSendOnBehalfTo != null)
     {
         foreach (ADRecipient adrecipient in this.grantSendOnBehalfTo)
         {
             contact.GrantSendOnBehalfTo.Add(adrecipient.Identity as ADObjectId);
         }
     }
     if (!base.Fields.IsModified(MailEnabledRecipientSchema.BypassModerationFromSendersOrMembers))
     {
         if (base.Fields.IsModified(MailEnabledRecipientSchema.BypassModerationFrom))
         {
             contact.BypassModerationFrom = this.bypassModerationFrom;
         }
         if (base.Fields.IsModified(MailEnabledRecipientSchema.BypassModerationFromDLMembers))
         {
             contact.BypassModerationFromDLMembers = this.bypassModerationFromDLMembers;
         }
     }
     if (this.DataObject != null && this.DataObject.IsModified(ADRecipientSchema.EmailAddresses))
     {
         contact.EmailAddresses = SyncTaskHelper.FilterDuplicateEmailAddresses(base.TenantGlobalCatalogSession, this.DataObject.EmailAddresses, this.DataObject, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskWarningLoggingDelegate(this.WriteWarning));
     }
     if (base.Fields.IsModified(ADRecipientSchema.AcceptMessagesOnlyFrom))
     {
         contact.AcceptMessagesOnlyFrom = (from c in this.acceptMessagesOnlyFrom
                                           select c.Identity as ADObjectId).ToArray <ADObjectId>();
     }
     if (base.Fields.IsModified(ADRecipientSchema.AcceptMessagesOnlyFromDLMembers))
     {
         contact.AcceptMessagesOnlyFromDLMembers = (from c in this.acceptMessagesOnlyFromDLMembers
                                                    select c.Identity as ADObjectId).ToArray <ADObjectId>();
     }
     if (base.Fields.IsModified(ADRecipientSchema.RejectMessagesFrom))
     {
         contact.RejectMessagesFrom = (from c in this.rejectMessagesFrom
                                       select c.Identity as ADObjectId).ToArray <ADObjectId>();
     }
     if (base.Fields.IsModified(ADRecipientSchema.RejectMessagesFromDLMembers))
     {
         contact.RejectMessagesFromDLMembers = (from c in this.rejectMessagesFromDLMembers
                                                select c.Identity as ADObjectId).ToArray <ADObjectId>();
     }
     if (base.Fields.IsModified(ADRecipientSchema.Certificate))
     {
         contact.UserCertificate = this.UserCertificate;
     }
     if (base.Fields.IsModified(ADRecipientSchema.SMimeCertificate))
     {
         contact.UserSMIMECertificate = this.UserSMimeCertificate;
     }
     if (base.Fields.IsModified(SyncMailContactSchema.CountryOrRegion))
     {
         contact.CountryOrRegion = this.CountryOrRegion;
     }
     TaskLogger.LogExit();
 }
예제 #6
0
        protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            ADGroup adgroup = (ADGroup)base.PrepareDataObject();

            adgroup.BypassModerationCheck = true;
            if (this.SmtpAndX500Addresses != null && this.SmtpAndX500Addresses.Count > 0)
            {
                adgroup.EmailAddresses = SyncTaskHelper.ReplaceSmtpAndX500Addresses(this.SmtpAndX500Addresses, adgroup.EmailAddresses);
            }
            if (base.Fields.IsModified("SipAddresses"))
            {
                adgroup.EmailAddresses = SyncTaskHelper.ReplaceSipAddresses(this.SipAddresses, adgroup.EmailAddresses);
            }
            if (adgroup.IsModified(MailEnabledRecipientSchema.EmailAddresses))
            {
                adgroup.EmailAddresses = SyncTaskHelper.FilterDuplicateEmailAddresses(base.TenantGlobalCatalogSession, adgroup.EmailAddresses, adgroup, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskWarningLoggingDelegate(this.WriteWarning));
            }
            if (base.Fields.IsModified(ADGroupSchema.GroupType))
            {
                if (this.Type != GroupType.Distribution && this.Type != GroupType.Security)
                {
                    base.WriteError(new RecipientTaskException(Strings.ErrorGroupTypeInvalid), ExchangeErrorCategory.Client, null);
                }
                bool flag = (adgroup.GroupType & GroupTypeFlags.SecurityEnabled) == GroupTypeFlags.SecurityEnabled;
                if (this.Type == GroupType.Distribution && flag)
                {
                    adgroup.GroupType &= (GroupTypeFlags)2147483647;
                    if ((adgroup.GroupType & GroupTypeFlags.Universal) == GroupTypeFlags.Universal)
                    {
                        adgroup.RecipientTypeDetails = RecipientTypeDetails.MailUniversalDistributionGroup;
                    }
                    else
                    {
                        adgroup.RecipientTypeDetails = RecipientTypeDetails.MailNonUniversalGroup;
                    }
                    base.DesiredRecipientType = adgroup.RecipientType;
                    if (!adgroup.IsChanged(ADRecipientSchema.RecipientDisplayType))
                    {
                        adgroup.RecipientDisplayType = new RecipientDisplayType?(RecipientDisplayType.DistributionGroup);
                    }
                }
                else if (this.Type == GroupType.Security && !flag)
                {
                    if (adgroup.RecipientTypeDetails == RecipientTypeDetails.RoomList)
                    {
                        base.WriteError(new TaskInvalidOperationException(Strings.ErrorConvertNonUniversalDistributionGroup(adgroup.Identity.ToString())), ExchangeErrorCategory.Client, adgroup.Identity);
                    }
                    adgroup.GroupType |= GroupTypeFlags.SecurityEnabled;
                    if ((adgroup.GroupType & GroupTypeFlags.Universal) == GroupTypeFlags.Universal)
                    {
                        adgroup.RecipientTypeDetails = RecipientTypeDetails.MailUniversalSecurityGroup;
                    }
                    else
                    {
                        adgroup.RecipientTypeDetails = RecipientTypeDetails.MailNonUniversalGroup;
                    }
                    base.DesiredRecipientType = adgroup.RecipientType;
                    if (!adgroup.IsChanged(ADRecipientSchema.RecipientDisplayType))
                    {
                        adgroup.RecipientDisplayType = new RecipientDisplayType?(RecipientDisplayType.SecurityDistributionGroup);
                    }
                }
            }
            TaskLogger.LogExit();
            return(adgroup);
        }