예제 #1
0
        public void SetSendConnector(ISendConnector configuration)
        {
            SessionParameters sessionParameters = this.SetSendConnectorParameters(configuration);

            sessionParameters.Set("Identity", configuration.Identity.ToString());
            base.RemotePowershellSession.RunOneCommand("Set-SendConnector", sessionParameters, false);
        }
예제 #2
0
        public static T ConvertTo <T>(this ISendConnector source)
            where T : ISendConnector, new()
        {
            var target = new T();

            source.CopyTo(target);

            return(target);
        }
예제 #3
0
        public ISendConnector NewSendConnector(ISendConnector configuration)
        {
            SessionParameters       parameters = this.SetSendConnectorParameters(configuration);
            SmtpSendConnectorConfig smtpSendConnectorConfig = base.RemotePowershellSession.RunOneCommandSingleResult <SmtpSendConnectorConfig>("New-SendConnector", parameters, false);

            if (smtpSendConnectorConfig != null)
            {
                return(new Microsoft.Exchange.Management.Hybrid.Entity.SendConnector(smtpSendConnectorConfig));
            }
            return(null);
        }
예제 #4
0
 public static void CopyTo(this ISendConnector source, ISendConnector target)
 {
     target.Id            = source.Id;
     target.Domains       = source.Domains; // TODO
     target.LocalAddress  = source.LocalAddress;
     target.RemoteAddress = source.RemoteAddress;
     target.RemotePort    = source.RemotePort;
     target.RetryCount    = source.RetryCount;
     target.RetryTime     = source.RetryTime;
     target.Name          = source.Name;
     target.UseSmarthost  = source.UseSmarthost;
     target.Password      = source.Password;
     target.Username      = source.Username;
     target.UseAuth       = source.UseAuth;
     target.TLSSettings   = source.TLSSettings; // TODO
 }
예제 #5
0
        private SessionParameters SetSendConnectorParameters(ISendConnector configuration)
        {
            SessionParameters sessionParameters = new SessionParameters();

            sessionParameters.Set("Name", configuration.Name);
            sessionParameters.Set <AddressSpace>("AddressSpaces", configuration.AddressSpaces);
            sessionParameters.Set <ADObjectId>("SourceTransportServers", configuration.SourceTransportServers);
            sessionParameters.Set("DNSRoutingEnabled", configuration.DNSRoutingEnabled);
            sessionParameters.Set <SmartHost>("SmartHosts", configuration.SmartHosts);
            sessionParameters.Set("TLSDomain", configuration.TlsDomain);
            sessionParameters.Set("RequireTLS", configuration.RequireTLS);
            sessionParameters.Set("TLSAuthLevel", (Enum)configuration.TlsAuthLevel);
            sessionParameters.Set("ErrorPolicies", configuration.ErrorPolicies);
            sessionParameters.Set("TLSCertificateName", TaskCommon.ToStringOrNull(configuration.TlsCertificateName));
            sessionParameters.Set("CloudServicesMailEnabled", configuration.CloudServicesMailEnabled);
            sessionParameters.Set("Fqdn", configuration.Fqdn);
            return(sessionParameters);
        }
예제 #6
0
        private ISendConnector GetMatchingSendConnector(string addressSpace)
        {
            ISendConnector sendConnector            = null;
            IEnumerable <ISendConnector> enumerable = base.OnPremisesSession.GetSendConnector();

            foreach (ISendConnector sendConnector2 in enumerable)
            {
                foreach (AddressSpace addressSpace2 in sendConnector2.AddressSpaces)
                {
                    if (addressSpace2.Address.Equals(addressSpace, StringComparison.InvariantCultureIgnoreCase))
                    {
                        if (sendConnector != null)
                        {
                            throw new LocalizedException(HybridStrings.ErrorDuplicateSendConnectorAddressSpace(addressSpace));
                        }
                        if (sendConnector2.AddressSpaces.Count > 1)
                        {
                            throw new LocalizedException(HybridStrings.ErrorSendConnectorAddressSpaceNotExclusive(addressSpace));
                        }
                        sendConnector = sendConnector2;
                    }
                }
            }
            if (sendConnector == null)
            {
                foreach (ISendConnector sendConnector3 in enumerable)
                {
                    if (string.Equals(sendConnector3.Name, this.DefaultSendConnectorName))
                    {
                        sendConnector = sendConnector3;
                        break;
                    }
                }
            }
            return(sendConnector);
        }