다음을 통해 공유


CReplicationServer.EnumProjects Method

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

Retrieves the Commerce Server Staging (CSS) projects that are defined on the server.

object EnumProjects(ref object iterator)

Parameters

  • iterator
    Used by the CSS service to enumerate the list of projects. This value should be initialized to 0 (zero) and should not be modified.

Return Value

The CReplicationProject object for this iteration.

Remarks

You must have CSS administrator or operator permissions to call this method.

This method sets e.ErrorCode to -2147422485 (“No more items.”) when there are no projects defined on the server. It returns an empty CReplicationProject object to indicate the end of the enumeration.

The CReplicationServer.EnumProjects method corresponds to the COM method named ReplicationServer.EnumProjects.

Example

The following example displays the names of the projects that are defined on the server.

CReplicationServer replicationServer = new CReplicationServer();
  replicationServer.Initialize("");
  Console.WriteLine("The projects are:");
  int iterator = 0;
  object i = iterator as object;
  while (true)
  {
    try
      {
      CReplicationProject project = (CReplicationProject)replicationServer.EnumProjects(ref i);
        Console.WriteLine(project.get_Name());
      }
      catch (System.Runtime.InteropServices.COMException e)
      {
          // Quit if "No more items" error
          if (e.ErrorCode == -2147422485)
              break;
          else
              throw e;
      }
  } 

See Also

Other Resources

Projects

How to Retrieve Staging Information

CReplicationProject Class

CReplicationServer Class