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

Определение

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

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

Поля

Имя Значение Описание
None 0

Нет доступа.

EnumerateServer 131074

Право на перечисление очередей на сервере печати.

UsePrinter 131080

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

AdministrateServer 983041

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

AdministratePrinter 983052

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

Примеры

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

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 .

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