Ejemplo n.º 1
0
		public static void SetConnectorId(SendConnector connector, ADObjectId sourceRgId)
		{
			connector.SetId(sourceRgId.GetChildId("Connections").GetChildId(connector.Name));
			TaskLogger.Trace("Set connector ID to '{0}'", new object[]
			{
				connector.Id
			});
		}
Ejemplo n.º 2
0
		public static void SetConnectorHomeMta(SendConnector connector, IConfigurationSession configSession)
		{
			Server server = configSession.Read<Server>(connector.SourceTransportServers[0]);
			connector.HomeMTA = server.ResponsibleMTA;
			TaskLogger.Trace("Set connector homeMTA to '{0}'", new object[]
			{
				connector.HomeMTA
			});
		}
        public HttpResponseMessage Post([FromBody] SendConnector sendConnector)
        {
            var added = _service.AddSendConnector(sendConnector);

            if (added == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Could not add send connector."));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, added));
        }
        public HttpResponseMessage Put(int id, [FromBody] SendConnector sendConnector)
        {
            var updated = _service.UpdateSendConnector(sendConnector);

            if (updated == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Could not update send connector."));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, updated));
        }
 public SendConnectorIdParameter(SendConnector connector) : base(connector.Id)
 {
 }
Ejemplo n.º 6
0
		public static LocalizedException ValidateTransportServers(IConfigurationSession session, SendConnector connector, ref ADObjectId routingGroupId, bool allowEdgeServers, bool sourceValidation, Task task, out bool edgeConnector, out bool multiSiteConnector)
		{
			edgeConnector = false;
			multiSiteConnector = false;
			MultiValuedProperty<ADObjectId> sourceTransportServers = connector.SourceTransportServers;
			if (sourceTransportServers != null && sourceTransportServers.Count != 0)
			{
				bool flag = false;
				ADObjectId adobjectId = null;
				MultiValuedProperty<ADObjectId> multiValuedProperty = new MultiValuedProperty<ADObjectId>();
				List<string> list = new List<string>();
				foreach (ADObjectId adobjectId2 in sourceTransportServers)
				{
					if (adobjectId2 != null)
					{
						Server server = session.Read<Server>(adobjectId2);
						if (server == null)
						{
							list.Add(adobjectId2.Name);
						}
						else
						{
							if (adobjectId == null)
							{
								if (routingGroupId == null)
								{
									routingGroupId = ManageSendConnectors.GetServerRoutingGroup(server);
									if (routingGroupId == null)
									{
										return new SendConnectorUndefinedServerRgException(adobjectId2.Name);
									}
								}
								flag = ManageSendConnectors.IsE12RoutingGroup(routingGroupId);
								if (allowEdgeServers)
								{
									edgeConnector = server.IsEdgeServer;
								}
								adobjectId = server.ServerSite;
							}
							else if (!multiSiteConnector)
							{
								multiSiteConnector = !adobjectId.Equals(server.ServerSite);
							}
							if (!routingGroupId.Equals(server.HomeRoutingGroup))
							{
								bool flag2 = false;
								if (!flag)
								{
									flag2 = true;
								}
								else if (server.HomeRoutingGroup != null)
								{
									flag2 = true;
								}
								else if (!server.IsExchange2007OrLater)
								{
									flag2 = true;
								}
								if (flag2)
								{
									return sourceValidation ? new SendConnectorWrongSourceServerRgException(adobjectId2.Name) : new SendConnectorWrongTargetServerRgException(adobjectId2.Name);
								}
							}
							if (flag)
							{
								if ((!server.IsEdgeServer || !allowEdgeServers) && !server.IsHubTransportServer)
								{
									return sourceValidation ? new SendConnectorWrongSourceServerRoleException(adobjectId2.Name) : new SendConnectorWrongTargetServerRoleException(adobjectId2.Name);
								}
								if (edgeConnector != server.IsEdgeServer)
								{
									return new SendConnectorMixedSourceServerRolesException();
								}
							}
							multiValuedProperty.Add(adobjectId2);
						}
					}
				}
				if (multiValuedProperty.Count != 0)
				{
					if (multiValuedProperty.Count != connector.SourceTransportServers.Count)
					{
						connector.SourceTransportServers = multiValuedProperty;
						if (task != null)
						{
							task.WriteWarning(Strings.WarningSourceServersSkipped(string.Join(", ", list)));
						}
					}
					return null;
				}
				if (!sourceValidation)
				{
					return new SendConnectorValidTargetServerNotFoundException();
				}
				return new SendConnectorValidSourceServerNotFoundException();
			}
			if (!sourceValidation)
			{
				return new SendConnectorTargetServersNotSetException();
			}
			return new SendConnectorSourceServersNotSetException();
		}
Ejemplo n.º 7
0
		public static LocalizedException ValidateTransportServers(IConfigurationSession session, SendConnector sendConnector, ref ADObjectId routingGroupId, Task task, bool sourceValidation, out bool multiSiteConnector)
		{
			bool flag;
			return ManageSendConnectors.ValidateTransportServers(session, sendConnector, ref routingGroupId, false, sourceValidation, task, out flag, out multiSiteConnector);
		}
Ejemplo n.º 8
0
 public SendConnector UpdateSendConnector(SendConnector connector)
 {
     return(_sendConnectors.Update(connector).ConvertTo <SendConnector>());
 }
Ejemplo n.º 9
0
 public SendConnector AddSendConnector(SendConnector connector)
 {
     return(_sendConnectors.Add(connector).ConvertTo <SendConnector>());
 }
Ejemplo n.º 10
0
 public SendConnector UpdateSendConnector(SendConnector connector)
 {
     return(Channel.UpdateSendConnector(connector));
 }
Ejemplo n.º 11
0
 public SendConnector AddSendConnector(SendConnector connector)
 {
     return(Channel.AddSendConnector(connector));
 }