PrintSystemDesiredAccess 枚举

定义

指定打印对象的不同访问权限(或访问级别)。Specifies the different access rights (or levels of access) for printing objects.

public enum class PrintSystemDesiredAccess
public enum PrintSystemDesiredAccess
type PrintSystemDesiredAccess = 
Public Enum PrintSystemDesiredAccess
继承
PrintSystemDesiredAccess

字段

AdministratePrinter 983052

执行打印队列的所有管理任务的权限,包括暂停和继续任何打印作业的权限;以及从队列中删除所有作业的权限。The right to perform all administrative tasks for the print queue, including the right to pause and resume any print job; and the right to delete all jobs from the queue. 此访问级别还包括 UsePrinter 之下的所有权限。This access level also includes all rights under UsePrinter.

AdministrateServer 983041

执行打印服务器的所有管理任务的权限。The right to perform all administrative tasks for the print server. 此访问级别不包括服务器承载的打印队列的 AdministratePrinter 权限。This access level does not include AdministratePrinter rights for the print queues hosted by the server.

EnumerateServer 131074

列出打印服务器上的队列的权限。The right to list the queues on the print server.

None 0

无访问权限。No access.

UsePrinter 131080

将打印作业添加到队列以及删除和枚举自己的作业的权限。The right to add print jobs to the queue and to delete and enumerate one's own jobs.

示例

下面的示例演示如何使用此枚举来安装在其属性中不同于现有打印机的、仅在 "位置"、"端口" 和 "共享" 状态中不同的第二个打印机。The following example shows how to use this enumeration to install a second printer that differs in its properties from an existing printer only in location, port, and shared status.

LocalPrintServer myLocalPrintServer = new LocalPrintServer(PrintSystemDesiredAccess.AdministrateServer);
PrintQueue sourcePrintQueue = myLocalPrintServer.DefaultPrintQueue;
PrintPropertyDictionary myPrintProperties = sourcePrintQueue.PropertiesCollection;

// Share the new printer using Remove/Add methods
PrintBooleanProperty shared = new PrintBooleanProperty("IsShared", true);
myPrintProperties.Remove("IsShared");
myPrintProperties.Add("IsShared", shared);

// Give the new printer its share name using SetProperty method
PrintStringProperty theShareName = new PrintStringProperty("ShareName", "\"Son of " + sourcePrintQueue.Name +"\"");
myPrintProperties.SetProperty("ShareName", theShareName);

// Specify the physical location of the new printer using Remove/Add methods
PrintStringProperty theLocation = new PrintStringProperty("Location", "the supply room");
myPrintProperties.Remove("Location");
myPrintProperties.Add("Location", theLocation);

// Specify the port for the new printer
String[] port = new String[] { "COM1:" };


// Install the new printer on the local print server
PrintQueue clonedPrinter = myLocalPrintServer.InstallPrintQueue("My clone of " + sourcePrintQueue.Name, "Xerox WCP 35 PS", port, "WinPrint", myPrintProperties);
myLocalPrintServer.Commit();

// Report outcome
Console.WriteLine("{0} in {1} has been installed and shared as {2}", clonedPrinter.Name, clonedPrinter.Location, clonedPrinter.ShareName);
Console.WriteLine("Press Return to continue ...");
Console.ReadLine();
Dim myLocalPrintServer As New LocalPrintServer(PrintSystemDesiredAccess.AdministrateServer)
Dim sourcePrintQueue As PrintQueue = myLocalPrintServer.DefaultPrintQueue
Dim myPrintProperties As PrintPropertyDictionary = sourcePrintQueue.PropertiesCollection

' Share the new printer using Remove/Add methods
Dim [shared] As New PrintBooleanProperty("IsShared", True)
myPrintProperties.Remove("IsShared")
myPrintProperties.Add("IsShared", [shared])

' Give the new printer its share name using SetProperty method
Dim theShareName As New PrintStringProperty("ShareName", """Son of " & sourcePrintQueue.Name & """")
myPrintProperties.SetProperty("ShareName", theShareName)

' Specify the physical location of the new printer using Remove/Add methods
Dim theLocation As New PrintStringProperty("Location", "the supply room")
myPrintProperties.Remove("Location")
myPrintProperties.Add("Location", theLocation)

' Specify the port for the new printer
Dim port() As String = { "COM1:" }


' Install the new printer on the local print server
Dim clonedPrinter As PrintQueue = myLocalPrintServer.InstallPrintQueue("My clone of " & sourcePrintQueue.Name, "Xerox WCP 35 PS", port, "WinPrint", myPrintProperties)
myLocalPrintServer.Commit()

' Report outcome
Console.WriteLine("{0} in {1} has been installed and shared as {2}", clonedPrinter.Name, clonedPrinter.Location, clonedPrinter.ShareName)
Console.WriteLine("Press Return to continue ...")
Console.ReadLine()

注解

每个访问级别提供的访问权限因以下各级别而异:The access rights that are available at each level of access vary according to the following:

  • 打印服务器是计算机还是打印服务器设备。Whether the print server is a computer or a print server appliance.

  • 使用的操作系统。The operating system that is used.

  • 已安装的安全更新。The security updates that are installed.

  • 支持的安全策略。The security policies that are supported.

出于此原因, 在 "成员" 部分中访问右说明是将与每个访问级别相对应的权限, 但列出的访问级别可能会提供对特定系统的更多或更少权限。For this reason, access right descriptions in the "Members" section are typical of the rights that will correspond to each access level, but the access levels listed may provide more or fewer rights on particular systems.

这些值主要用作和PrintServer PrintQueue构造函数的参数。These values are primarily used as parameters for PrintServer and PrintQueue constructors. 如果使用只能应用于其他类型的对象的值, 则构造函数将引发异常。The constructors will throw exceptions if you use a value that can apply only to another kind of object. 例如, 不要将 AdministratePrinter 传递到PrintServer构造函数。For example, do not pass AdministratePrinter to a PrintServer constructor.

适用于