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のすべての権限も含まれます。

次の例では、この列挙体を使用して、場所、ポート、および共有状態でのみ、既存のプリンターとはプロパティが異なる 2 つ目のプリンターをインストールする方法を示します。

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 コンストラクターに渡さないでください。

適用対象