다음을 통해 공유


CReplicationRoute.AddDestination Method

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

Adds a destination to a Commerce Server Staging (CSS) route.

Note

Routes can be used only to stage Web content and business data.

void AddDestination(string destination)

Parameters

  • destination
    The name of a server to add to the route.

    When you call this method from the server where you are logged in, you can also set the authentication credentials for the destination server by specifying "Destination;UserName;Password".

Remarks

You must have CSS administrator rights to call this method.

Duplicate destination names are automatically eliminated from the list of destinations that are defined for a route.

The CReplicationRoute.AddDestination method corresponds to the COM method named ReplicationRoute.AddDestination.

Example

The following example adds the destination server Marrakech to the Test route.

CReplicationServer replicationServer = new CReplicationServer();
replicationServer.Initialize("");
CReplicationRoute replicationRoute;
int i = 0;
object iterator = i as object;
while (true)
  {
  try
    {
    replicationRoute = replicationServer.EnumRoutes(ref iterator) as CReplicationRoute;
    // If the route is Test, add Marrakech
    if (replicationRoute.get_Name().ToString() == "Test")
      {
      replicationRoute.AddDestination("Marrakech");
      replicationRoute.Commit();
      break;
      }
    }
    catch (System.Runtime.InteropServices.COMException e)
    {
       // Quit if "No more items" or "No routes" error
       if (e.ErrorCode == -2147422485 || e.ErrorCode == -1073680678)
         break;
       else
         throw;
      }
    }
  }

See Also

Other Resources

How to Manage Routes

CReplicationRoute.EnumDestination Method

CReplicationRoute.RemoveDestination Method

CReplicationRoute Class