Partager via


CReplicationProject.EnumAccess Method

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

Retrieves the user name and Commerce Server Staging (CSS) user rights for users who are authorized to modify or run a CSS project.

object EnumAccess(ref object iterator, out object access)

Parameters

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

  • access
    Used to return the access value. The following table shows the possible access rights.

    Name

    Value

    Description

    CSS_ADMIN_ACCESS

    983103

    The user has CSS administrator access rights.

    CSS_USER_ACCESS

    131097

    The user has CSS operator access rights.

Return Value

A string that contains the name of the user who is associated with the CSS user rights value.

Remarks

You must have CSS administrator rights to call this method.

To check the CSS user rights of an individual user, use the CheckAccess method. To assign user rights to an individual user, use the GrantAccess method.

The EnumAccess method sets the value of e.ErrorCode to -2147422485 (“No more items.”) to indicate the end of the enumeration.

The CReplicationProject.EnumAccess method corresponds to the COM method named ReplicationProject.EnumAccess.

Example

The following example displays the access rights of the users on the project named Project1.

CReplicationServer replicationServer = new CReplicationServer();
  replicationServer.Initialize("");
  CReplicationProject replicationProject;
  replicationProject = (CReplicationProject)replicationServer.OpenProject("Project1", CSS_PROJECT_CREATION.OPEN_EXISTING_PROJECT);

  int i = 0;
  object iterator = i as object;
  while (true)
  {
  try
    {
    object accessPriv;
    string username = (string)replicationProject.EnumAccess(ref iterator, out accessPriv);
      if ((int)accessPriv == 0x20019)
        Console.WriteLine("{0} has operator access.", username);
      else if ((int)accessPriv == 0xF003F)
        Console.WriteLine("{0} has administrator access.", username);
    }
      catch (System.Runtime.InteropServices.COMException e)
        {
               // Exit if "No more items" error
                 if (e.ErrorCode == -2147422485)
                    break;
                 else
                    throw e;
         }
    }

See Also

Other Resources

Projects

How to Retrieve Project Information

CReplicationProject.CheckAccess Method

CReplicationProject.GrantAccess Method

CReplicationProject Class