PrintSystemDesiredAccess Enum
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Anger de olika åtkomsträttigheterna (eller åtkomstnivåerna) för utskrift av objekt.
public enum class PrintSystemDesiredAccess
public enum PrintSystemDesiredAccess
type PrintSystemDesiredAccess =
Public Enum PrintSystemDesiredAccess
- Arv
Fält
| Name | Värde | Description |
|---|---|---|
| None | 0 | Ingen åtkomst. |
| EnumerateServer | 131074 | Rätten att visa köerna på utskriftsservern. |
| UsePrinter | 131080 | Rätten att lägga till utskriftsjobb i kön och att ta bort och räkna upp sina egna jobb. |
| AdministrateServer | 983041 | Rätten att utföra alla administrativa uppgifter för utskriftsservern. Den här åtkomstnivån innehåller AdministratePrinterinte rättigheter för utskriftsköerna som hanteras av servern. |
| AdministratePrinter | 983052 | Rätten att utföra alla administrativa uppgifter för utskriftskön, inklusive rätten att pausa och återuppta alla utskriftsjobb. och rätten att ta bort alla jobb från kön. Den här åtkomstnivån innehåller även alla rättigheter under UsePrinter. |
Exempel
I följande exempel visas hur du använder den här uppräkningen för att installera en andra skrivare som skiljer sig i dess egenskaper från en befintlig skrivare endast på plats, port och delad 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()
Kommentarer
De åtkomsträttigheter som är tillgängliga på varje åtkomstnivå varierar beroende på följande:
Om utskriftsservern är en dator eller en utskriftsserverinstallation.
Det operativsystem som används.
De säkerhetsuppdateringar som är installerade.
De säkerhetsprinciper som stöds.
Därför är åtkomsträttsbeskrivningar i avsnittet "Medlemmar" typiska för de rättigheter som motsvarar varje åtkomstnivå, men de åtkomstnivåer som anges kan ge mer eller färre rättigheter för vissa system.
Dessa värden används främst som parametrar för PrintServer och PrintQueue konstruktorer. Konstruktorerna utlöser undantag om du använder ett värde som bara kan gälla för en annan typ av objekt. Skicka till exempel inte AdministratePrinter till en PrintServer konstruktor.