PrintSystemDesiredAccess Перечисление

Определение

Указывает различные права доступа (или уровни доступа) к объектам печати.

public enum class PrintSystemDesiredAccess
public enum PrintSystemDesiredAccess
type PrintSystemDesiredAccess = 
Public Enum PrintSystemDesiredAccess
Наследование
PrintSystemDesiredAccess

Поля

AdministratePrinter 983052

Право на выполнение всех административных задач, касающихся очереди печати, включая право на приостановку и возобновление любого задания печати и право на удаление всех заданий из очереди. В этот уровень доступа также входят все права, определенные для уровня UsePrinter.

AdministrateServer 983041

Право на выполнение всех административных задач, касающихся сервера печати. Этот уровень доступа не включает права AdministratePrinter для очередей печати, которые размещаются на сервере.

EnumerateServer 131074

Право на перечисление очередей, которые размещаются на сервере печати.

None 0

Нет доступа.

UsePrinter 131080

Право на добавление заданий печати в очередь, а также на удаление и перечисление заданий, которые в ней содержатся.

Примеры

В следующем примере показано, как использовать это перечисление для установки второго принтера, который отличается по своим свойствам от существующего принтера только по расположению, порту и общему состоянию.

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()

Комментарии

Права доступа, доступные на каждом уровне доступа, зависят от следующего:

  • Является ли сервер печати компьютером или устройством сервера печати.

  • Используемая операционная система.

  • Установленные обновления для системы безопасности.

  • Поддерживаемые политики безопасности.

По этой причине описания прав доступа в разделе "Участники" являются типичными для прав, которые будут соответствовать каждому уровню доступа, но перечисленные уровни доступа могут предоставлять больше или меньше прав в определенных системах.

Эти значения в основном используются в качестве параметров для PrintServer конструкторов и PrintQueue . Конструкторы будут создавать исключения, если вы используете значение, которое может применяться только к другому типу объекта. Например, не передайте AdministratePrinter конструктору PrintServer .

Применяется к