PrintServer.InstallPrintQueue Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Installs a print queue, and its associated printer driver, on the print server.
Overloads
InstallPrintQueue(String, String, String[], String, PrintPropertyDictionary) |
Installs a print queue, and associated printer driver, on the print server. |
InstallPrintQueue(String, String, String[], String, PrintQueueAttributes) |
Installs a print queue, and associated printer driver, on the print server. |
InstallPrintQueue(String, String, String[], String, PrintQueueAttributes, PrintQueueStringProperty, Int32, Int32) |
Installs a prioritized print queue, and associated printer driver, on the print server. |
InstallPrintQueue(String, String, String[], String, PrintQueueAttributes, String, String, String, String, Int32, Int32) |
Installs a shared, prioritized print queue, and associated printer driver, on the print server. |
InstallPrintQueue(String, String, String[], String, PrintPropertyDictionary)
Installs a print queue, and associated printer driver, on the print server.
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
Parameters
- printQueueName
- String
The name of the new queue.
- driverName
- String
The path and name of the printer driver.
- portNames
- String[]
The IDs of the ports that the new queue uses.
- printProcessorName
- String
The name of the print processor.
- initialParameters
- PrintPropertyDictionary
The parameters that are initialized.
Returns
The new PrintQueue.
Examples
The following example shows how to use this method (called on the LocalPrintServer object that inherits the method from PrintServer) to install a second printer that differs in its properties from an existing printer only in location, port, and shared 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()
Applies to
InstallPrintQueue(String, String, String[], String, PrintQueueAttributes)
Installs a print queue, and associated printer driver, on the print server.
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
Parameters
- printQueueName
- String
The name of the new queue.
- driverName
- String
The path and name of the printer driver.
- portNames
- String[]
The IDs of the ports that the new queue uses.
- printProcessorName
- String
The name of the print processor.
- printQueueAttributes
- PrintQueueAttributes
The attributes, as flags, of the new queue.
Returns
The newly created PrintQueue.
Applies to
InstallPrintQueue(String, String, String[], String, PrintQueueAttributes, PrintQueueStringProperty, Int32, Int32)
Installs a prioritized print queue, and associated printer driver, on the print server.
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
Parameters
- printQueueName
- String
The name of the new queue.
- driverName
- String
The path and name of the printer driver.
- portNames
- String[]
The IDs of the ports that the new queue uses.
- printProcessorName
- String
The name of the print processor.
- printQueueAttributes
- PrintQueueAttributes
The attributes, as flags, of the new queue.
- printQueueProperty
- PrintQueueStringProperty
The comment, location, or share name of the new queue.
- printQueuePriority
- Int32
A value from 1 through 99 that specifies the priority of this print queue relative to other queues that are hosted by the print server.
- printQueueDefaultPriority
- Int32
A value from 1 to 99 that specifies the default priority of print jobs that are sent to the queue.
Returns
The newly created PrintQueue.
Remarks
Use the printQueueProperty
parameter to initialize one, and only one, of the queue's ShareName, Comment, or Location properties. If you want to initialize more than one, use the InstallPrintQueue(String, String, String[], String, PrintQueueAttributes, String, String, String, String, Int32, Int32) overload of this method.
Applies to
InstallPrintQueue(String, String, String[], String, PrintQueueAttributes, String, String, String, String, Int32, Int32)
Installs a shared, prioritized print queue, and associated printer driver, on the print server.
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
Parameters
- printQueueName
- String
The name of the new queue.
- driverName
- String
The path and name of the printer driver.
- portNames
- String[]
The IDs of the ports that the new queue uses.
- printProcessorName
- String
The name of the print processor.
- printQueueAttributes
- PrintQueueAttributes
The attributes, as flags, of the new queue.
- printQueueShareName
- String
The share name of the new queue.
- printQueueComment
- String
A comment about the queue that is visible to users in the Microsoft Windows UI.
- printQueueLocation
- String
The location of the new queue.
- printQueueSeparatorFile
- String
The path of a file that is inserted at the beginning of each print job.
- printQueuePriority
- Int32
A value from 1 through 99 that specifies the priority of the queue relative to other queues that are hosted by the print server.
- printQueueDefaultPriority
- Int32
A value from 1 through 99 that specifies the default priority of new print jobs that are sent to the queue.
Returns
The newly created PrintQueue.
Remarks
If you do not want to initialize all three of the queue's ShareName, Comment, or Location properties; you can pass an empty string for one or more of printQueueShareName
, printQueueComment
, and printQueueLocation
. If you want to initialize just one of these properties, use the InstallPrintQueue(String, String, String[], String, PrintQueueAttributes, PrintQueueStringProperty, Int32, Int32) overload of this method.