コード例 #1
0
 public static void ValidateExternalEmailAddress(ADContact contact, IConfigurationSession configurationSession, Task.ErrorLoggerDelegate writeError, ProvisioningCache provisioningCache)
 {
     if (VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).CmdletInfra.ValidateExternalEmailAddressInAcceptedDomain.Enabled)
     {
         SmtpProxyAddress smtpProxyAddress = contact.ExternalEmailAddress as SmtpProxyAddress;
         if (smtpProxyAddress == null)
         {
             writeError(new RecipientTaskException(Strings.ErrorExternalEmailAddressNotSmtpAddress((contact.ExternalEmailAddress == null) ? "$null" : contact.ExternalEmailAddress.ToString())), ExchangeErrorCategory.Client, contact.Identity);
             return;
         }
         if (RecipientTaskHelper.SMTPAddressCheckWithAcceptedDomain(configurationSession, contact.OrganizationId, writeError, provisioningCache))
         {
             string domain = new SmtpAddress(smtpProxyAddress.SmtpAddress).Domain;
             if (RecipientTaskHelper.IsAcceptedDomain(configurationSession, contact.OrganizationId, domain, provisioningCache))
             {
                 writeError(new RecipientTaskException(Strings.ErrorIsAcceptedDomain(domain)), ExchangeErrorCategory.Client, null);
             }
         }
         contact.EmailAddressPolicyEnabled = false;
         if (contact.PrimarySmtpAddress == SmtpAddress.Empty)
         {
             contact.PrimarySmtpAddress = new SmtpAddress(smtpProxyAddress.SmtpAddress);
         }
     }
 }
コード例 #2
0
 internal static MailContact FromDataObject(ADContact dataObject)
 {
     if (dataObject == null)
     {
         return(null);
     }
     return(new MailContact(dataObject));
 }
コード例 #3
0
        protected override void InternalValidate()
        {
            base.InternalValidate();
            ADContact dataObject = this.DataObject;

            if (dataObject.RecipientTypeDetails == RecipientTypeDetails.MailForestContact && this.IsObjectStateChanged())
            {
                base.WriteError(new TaskInvalidOperationException(Strings.SetMailForestContactNotAllowed(dataObject.Name)), ExchangeErrorCategory.Client, this.DataObject.Identity);
            }
            if (this.GenerateExternalDirectoryObjectId && (RecipientTaskHelper.GetAcceptedRecipientTypes() & this.DataObject.RecipientTypeDetails) == RecipientTypeDetails.None)
            {
                base.WriteError(new RecipientTaskException(Strings.ErrorCannotGenerateExternalDirectoryObjectIdOnInternalRecipientType(this.Identity.ToString(), this.DataObject.RecipientTypeDetails.ToString())), ExchangeErrorCategory.Client, this.Identity);
            }
        }
コード例 #4
0
        protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            ADContact adcontact = (ADContact)base.PrepareDataObject();

            if (adcontact.RecipientDisplayType == null)
            {
                adcontact.RecipientDisplayType = new RecipientDisplayType?(RecipientDisplayType.RemoteMailUser);
            }
            if (adcontact.IsChanged(ADRecipientSchema.ExternalEmailAddress))
            {
                MailContactTaskHelper.ValidateExternalEmailAddress(adcontact, this.ConfigurationSession, new Task.ErrorLoggerDelegate(base.WriteError), base.ProvisioningCache);
            }
            TaskLogger.LogExit();
            return(adcontact);
        }
コード例 #5
0
        protected override void InternalValidate()
        {
            base.InternalValidate();
            ADContact dataObject = base.DataObject;

            if (dataObject.RecipientTypeDetails == RecipientTypeDetails.MailForestContact)
            {
                base.WriteError(new TaskInvalidOperationException(Strings.RemoveMailForestContactNotAllowed(dataObject.Name)), ExchangeErrorCategory.Client, base.DataObject.Identity);
            }
            if (base.DataObject.CatchAllRecipientBL.Count > 0)
            {
                string domain = string.Join(", ", (from r in base.DataObject.CatchAllRecipientBL
                                                   select r.Name).ToArray <string>());
                base.WriteError(new CannotRemoveMailContactCatchAllRecipientException(domain), ExchangeErrorCategory.Client, base.DataObject.Identity);
            }
        }
コード例 #6
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);
        }
コード例 #7
0
        protected override IConfigurable ConvertDataObjectToPresentationObject(IConfigurable dataObject)
        {
            if (dataObject == null)
            {
                return(null);
            }
            ADContact       dataObject2     = (ADContact)dataObject;
            SyncMailContact syncMailContact = new SyncMailContact(dataObject2);

            syncMailContact.propertyBag.SetField(ADRecipientSchema.AcceptMessagesOnlyFrom, SyncTaskHelper.RetrieveFullADObjectId(base.TenantGlobalCatalogSession, syncMailContact.AcceptMessagesOnlyFrom));
            syncMailContact.propertyBag.SetField(ADRecipientSchema.AcceptMessagesOnlyFromDLMembers, SyncTaskHelper.RetrieveFullADObjectId(base.TenantGlobalCatalogSession, syncMailContact.AcceptMessagesOnlyFromDLMembers));
            syncMailContact.propertyBag.SetField(ADRecipientSchema.RejectMessagesFrom, SyncTaskHelper.RetrieveFullADObjectId(base.TenantGlobalCatalogSession, syncMailContact.RejectMessagesFrom));
            syncMailContact.propertyBag.SetField(ADRecipientSchema.RejectMessagesFromDLMembers, SyncTaskHelper.RetrieveFullADObjectId(base.TenantGlobalCatalogSession, syncMailContact.RejectMessagesFromDLMembers));
            if (this.outputCookie != null)
            {
                syncMailContact.propertyBag.SetField(SyncMailContactSchema.Cookie, this.outputCookie.ToBytes());
                if (this.outputCookie.HighWatermark == 0L)
                {
                    syncMailContact.propertyBag.SetField(SyncMailContactSchema.EndOfList, true);
                }
            }
            return(syncMailContact);
        }
コード例 #8
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();
 }
コード例 #9
0
        // Token: 0x060003B5 RID: 949 RVA: 0x00015440 File Offset: 0x00013640
        internal static ADObject CreateAndInitializeRecipientObject <TRecipientObject>(ADPropertyBag propertyBag, ADRawEntry dummyObject, IRecipientSession recipientSession) where TRecipientObject : IConfigurable, new()
        {
            ArgumentValidator.ThrowIfNull("propertyBag", propertyBag);
            ArgumentValidator.ThrowIfNull("dummyObject", dummyObject);
            MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)propertyBag[ADObjectSchema.ObjectClass];
            ADObject adobject;

            if (dummyObject is OWAMiniRecipient)
            {
                adobject = new OWAMiniRecipient();
            }
            else if (dummyObject is ActiveSyncMiniRecipient)
            {
                adobject = new ActiveSyncMiniRecipient();
            }
            else if (dummyObject is StorageMiniRecipient)
            {
                adobject = new StorageMiniRecipient();
            }
            else if (dummyObject is TransportMiniRecipient)
            {
                adobject = new TransportMiniRecipient();
            }
            else if (dummyObject is LoadBalancingMiniRecipient)
            {
                adobject = new LoadBalancingMiniRecipient();
            }
            else if (dummyObject is MiniRecipientWithTokenGroups)
            {
                adobject = new MiniRecipientWithTokenGroups();
            }
            else if (dummyObject is FrontEndMiniRecipient)
            {
                adobject = new FrontEndMiniRecipient();
            }
            else if (dummyObject is MiniRecipient)
            {
                adobject = new MiniRecipient();
            }
            else if (dummyObject is RemovedMailbox)
            {
                adobject = new RemovedMailbox();
            }
            else if (dummyObject is DeletedRecipient)
            {
                adobject = new DeletedRecipient();
            }
            else if (multiValuedProperty.Contains(ADComputerRecipient.MostDerivedClass))
            {
                adobject = new ADComputerRecipient();
            }
            else if (multiValuedProperty.Contains(ADUser.MostDerivedClass))
            {
                adobject = new ADUser();
            }
            else if (multiValuedProperty.Contains(ADContact.MostDerivedClass))
            {
                adobject = new ADContact();
            }
            else if (multiValuedProperty.Contains(ADGroup.MostDerivedClass))
            {
                adobject = new ADGroup();
            }
            else if (multiValuedProperty.Contains(ADDynamicGroup.MostDerivedClass))
            {
                adobject = new ADDynamicGroup();
            }
            else if (multiValuedProperty.Contains(ADPublicFolder.MostDerivedClass))
            {
                adobject = new ADPublicFolder();
            }
            else if (multiValuedProperty.Contains(ADSystemAttendantMailbox.MostDerivedClass))
            {
                adobject = new ADSystemAttendantMailbox();
            }
            else if (multiValuedProperty.Contains(ADSystemMailbox.MostDerivedClass))
            {
                adobject = new ADSystemMailbox();
            }
            else if (multiValuedProperty.Contains(ADPublicDatabase.MostDerivedClass))
            {
                adobject = new ADPublicDatabase();
            }
            else
            {
                if (!multiValuedProperty.Contains(ADMicrosoftExchangeRecipient.MostDerivedClass))
                {
                    string objectClass = string.Empty;
                    foreach (string text in multiValuedProperty)
                    {
                        objectClass = text;
                    }
                    ObjectValidationError error = new ObjectValidationError(DirectoryStrings.UnsupportedObjectClass(objectClass), (ADObjectId)propertyBag[ADObjectSchema.Id], string.Empty);
                    ADProviderPerf.UpdateProcessCounter(Counter.ProcessRateCriticalValidationFailures, UpdateType.Update, 1U);
                    Globals.LogEvent(DirectoryEventLogConstants.Tuple_DSC_EVENT_VALIDATION_FAILED_FCO_MODE_RECIPIENT, ((ADObjectId)propertyBag[ADObjectSchema.Id]).ToString(), new object[]
                    {
                        ((ADObjectId)propertyBag[ADObjectSchema.Id]).ToDNString()
                    });
                    throw new DataValidationException(error);
                }
                adobject = new ADMicrosoftExchangeRecipient();
            }
            adobject.m_Session   = recipientSession;
            adobject.propertyBag = propertyBag;
            adobject.Initialize();
            adobject.ResetChangeTracking(true);
            if (recipientSession != null)
            {
                adobject.SetIsReadOnly(recipientSession.ReadOnly);
            }
            ExTraceGlobals.ADReadDetailsTracer.TraceDebug <string, RecipientType>((long)((recipientSession != null) ? recipientSession.GetHashCode() : 0), "ADRecipientObjectSession::CreateObject - Got {0} as {1}", adobject.DistinguishedName, (RecipientType)adobject[ADRecipientSchema.RecipientType]);
            return(adobject);
        }
コード例 #10
0
 public MailContact(ADContact dataObject) : base(dataObject)
 {
 }
コード例 #11
0
        protected override IConfigurable ConvertDataObjectToPresentationObject(IConfigurable dataObject)
        {
            ADContact dataObject2 = (ADContact)dataObject;

            return(new SyncMailContact(dataObject2));
        }