PrintServer.InstallPrintQueue 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
在列印伺服器上安裝列印佇列及其關聯的印表機驅動程式。
多載
InstallPrintQueue(String, String, String[], String, PrintPropertyDictionary) |
在列印伺服器上安裝列印佇列及關聯的印表機驅動程式。 |
InstallPrintQueue(String, String, String[], String, PrintQueueAttributes) |
在列印伺服器上安裝列印佇列及關聯的印表機驅動程式。 |
InstallPrintQueue(String, String, String[], String, PrintQueueAttributes, PrintQueueStringProperty, Int32, Int32) |
在列印伺服器上,安裝排定優先權的列印佇列及關聯的印表機驅動程式。 |
InstallPrintQueue(String, String, String[], String, PrintQueueAttributes, String, String, String, String, Int32, Int32) |
在列印伺服器上安裝共用、排定優先權的列印佇列及關聯的印表機驅動程式。 |
InstallPrintQueue(String, String, String[], String, PrintPropertyDictionary)
在列印伺服器上安裝列印佇列及關聯的印表機驅動程式。
public:
System::Printing::PrintQueue ^ InstallPrintQueue(System::String ^ printQueueName, System::String ^ driverName, cli::array <System::String ^> ^ portNames, System::String ^ printProcessorName, System::Printing::IndexedProperties::PrintPropertyDictionary ^ initialParameters);
public System.Printing.PrintQueue InstallPrintQueue (string printQueueName, string driverName, string[] portNames, string printProcessorName, System.Printing.IndexedProperties.PrintPropertyDictionary initialParameters);
member this.InstallPrintQueue : string * string * string[] * string * System.Printing.IndexedProperties.PrintPropertyDictionary -> System.Printing.PrintQueue
Public Function InstallPrintQueue (printQueueName As String, driverName As String, portNames As String(), printProcessorName As String, initialParameters As PrintPropertyDictionary) As PrintQueue
參數
- printQueueName
- String
新佇列的名稱。
- driverName
- String
印表機驅動程式的路徑和名稱。
- portNames
- String[]
新佇列使用的通訊埠 ID。
- printProcessorName
- String
列印處理器的名稱。
- initialParameters
- PrintPropertyDictionary
初始化的參數。
傳回
新的 PrintQueue。
範例
下列範例示範如何在繼承 方法的 PrintServer 物件上使用LocalPrintServer這個方法 (從) 呼叫,以安裝與現有印表機在位置、埠和共享狀態中不同的第二部列印機。
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()
適用於
InstallPrintQueue(String, String, String[], String, PrintQueueAttributes)
在列印伺服器上安裝列印佇列及關聯的印表機驅動程式。
public:
System::Printing::PrintQueue ^ InstallPrintQueue(System::String ^ printQueueName, System::String ^ driverName, cli::array <System::String ^> ^ portNames, System::String ^ printProcessorName, System::Printing::PrintQueueAttributes printQueueAttributes);
public System.Printing.PrintQueue InstallPrintQueue (string printQueueName, string driverName, string[] portNames, string printProcessorName, System.Printing.PrintQueueAttributes printQueueAttributes);
member this.InstallPrintQueue : string * string * string[] * string * System.Printing.PrintQueueAttributes -> System.Printing.PrintQueue
Public Function InstallPrintQueue (printQueueName As String, driverName As String, portNames As String(), printProcessorName As String, printQueueAttributes As PrintQueueAttributes) As PrintQueue
參數
- printQueueName
- String
新佇列的名稱。
- driverName
- String
印表機驅動程式的路徑和名稱。
- portNames
- String[]
新佇列使用的通訊埠 ID。
- printProcessorName
- String
列印處理器的名稱。
- printQueueAttributes
- PrintQueueAttributes
新佇列的屬性,如同旗標。
傳回
新建立的 PrintQueue。
適用於
InstallPrintQueue(String, String, String[], String, PrintQueueAttributes, PrintQueueStringProperty, Int32, Int32)
在列印伺服器上,安裝排定優先權的列印佇列及關聯的印表機驅動程式。
public:
System::Printing::PrintQueue ^ InstallPrintQueue(System::String ^ printQueueName, System::String ^ driverName, cli::array <System::String ^> ^ portNames, System::String ^ printProcessorName, System::Printing::PrintQueueAttributes printQueueAttributes, System::Printing::PrintQueueStringProperty ^ printQueueProperty, int printQueuePriority, int printQueueDefaultPriority);
public System.Printing.PrintQueue InstallPrintQueue (string printQueueName, string driverName, string[] portNames, string printProcessorName, System.Printing.PrintQueueAttributes printQueueAttributes, System.Printing.PrintQueueStringProperty printQueueProperty, int printQueuePriority, int printQueueDefaultPriority);
member this.InstallPrintQueue : string * string * string[] * string * System.Printing.PrintQueueAttributes * System.Printing.PrintQueueStringProperty * int * int -> System.Printing.PrintQueue
Public Function InstallPrintQueue (printQueueName As String, driverName As String, portNames As String(), printProcessorName As String, printQueueAttributes As PrintQueueAttributes, printQueueProperty As PrintQueueStringProperty, printQueuePriority As Integer, printQueueDefaultPriority As Integer) As PrintQueue
參數
- printQueueName
- String
新佇列的名稱。
- driverName
- String
印表機驅動程式的路徑和名稱。
- portNames
- String[]
新佇列使用的通訊埠 ID。
- printProcessorName
- String
列印處理器的名稱。
- printQueueAttributes
- PrintQueueAttributes
新佇列的屬性,如同旗標。
- printQueueProperty
- PrintQueueStringProperty
新佇列的註解、位置或共用名稱。
- printQueuePriority
- Int32
範圍從 1 到 99 的值,指定這個列印佇列相對於列印伺服器裝載之其他佇列的優先權。
- printQueueDefaultPriority
- Int32
範圍從 1 到 99 的值,指定傳送到佇列之列印工作的預設優先權。
傳回
新建立的 PrintQueue。
備註
printQueueProperty
使用 參數來初始化佇列 、、 或 Location 屬性的ShareNameComment其中一個和只有一個。 如果您想要初始化多個,請使用 InstallPrintQueue(String, String, String[], String, PrintQueueAttributes, String, String, String, String, Int32, Int32) 這個方法的多載。
適用於
InstallPrintQueue(String, String, String[], String, PrintQueueAttributes, String, String, String, String, Int32, Int32)
在列印伺服器上安裝共用、排定優先權的列印佇列及關聯的印表機驅動程式。
public:
System::Printing::PrintQueue ^ InstallPrintQueue(System::String ^ printQueueName, System::String ^ driverName, cli::array <System::String ^> ^ portNames, System::String ^ printProcessorName, System::Printing::PrintQueueAttributes printQueueAttributes, System::String ^ printQueueShareName, System::String ^ printQueueComment, System::String ^ printQueueLocation, System::String ^ printQueueSeparatorFile, int printQueuePriority, int printQueueDefaultPriority);
public System.Printing.PrintQueue InstallPrintQueue (string printQueueName, string driverName, string[] portNames, string printProcessorName, System.Printing.PrintQueueAttributes printQueueAttributes, string printQueueShareName, string printQueueComment, string printQueueLocation, string printQueueSeparatorFile, int printQueuePriority, int printQueueDefaultPriority);
member this.InstallPrintQueue : string * string * string[] * string * System.Printing.PrintQueueAttributes * string * string * string * string * int * int -> System.Printing.PrintQueue
Public Function InstallPrintQueue (printQueueName As String, driverName As String, portNames As String(), printProcessorName As String, printQueueAttributes As PrintQueueAttributes, printQueueShareName As String, printQueueComment As String, printQueueLocation As String, printQueueSeparatorFile As String, printQueuePriority As Integer, printQueueDefaultPriority As Integer) As PrintQueue
參數
- printQueueName
- String
新佇列的名稱。
- driverName
- String
印表機驅動程式的路徑和名稱。
- portNames
- String[]
新佇列使用的通訊埠 ID。
- printProcessorName
- String
列印處理器的名稱。
- printQueueAttributes
- PrintQueueAttributes
新佇列的屬性,如同旗標。
- printQueueShareName
- String
新佇列的共用名稱。
- printQueueComment
- String
Microsoft Windows UI 中用戶可看見之佇列的批注。
- printQueueLocation
- String
新佇列的位置。
- printQueueSeparatorFile
- String
插入每個列印工作開始處的檔案路徑。
- printQueuePriority
- Int32
範圍從 1 到 99 的值,指定佇列相對於列印伺服器裝載之其他佇列的優先權。
- printQueueDefaultPriority
- Int32
範圍從 1 到 99 的值,指定傳送到佇列之新列印工作的預設優先權。
傳回
新建立的 PrintQueue。
備註
如果您不想初始化這三個佇列ShareName的、 Comment或 Location 屬性;您可以傳遞一或多個、 printQueueComment
和 printQueueLocation
的printQueueShareName
空字串。 如果您想要只初始化其中一個屬性,請使用 InstallPrintQueue(String, String, String[], String, PrintQueueAttributes, PrintQueueStringProperty, Int32, Int32) 這個方法的多載。