PrintServer.GetPrintQueues 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.
Gets the collection of print queues that the print server hosts.
Overloads
GetPrintQueues(String[], EnumeratedPrintQueueTypes[]) |
Gets the collection of print queues, which are of the specified EnumeratedPrintQueueTypes and are initialized only in the specified properties. |
GetPrintQueues(PrintQueueIndexedProperty[], EnumeratedPrintQueueTypes[]) |
Gets a collection of print queues of the specified types. These print queues are only initialized in the properties that are specified in the PrintQueueIndexedProperty array. |
GetPrintQueues(String[]) |
Gets a collection of print queues that are hosted by the print server and that are initialized only in the specified properties. |
GetPrintQueues(EnumeratedPrintQueueTypes[]) |
Gets the collection of print queues of the specified types that are named in EnumeratedPrintQueueTypes and hosted by the print server. |
GetPrintQueues() |
Gets the collection of print queues that the print server hosts. |
GetPrintQueues(PrintQueueIndexedProperty[]) |
Gets a collection of print queues that are hosted by the print server and initialized only in the properties that are specified in the PrintQueueIndexedProperty array. |
GetPrintQueues(String[], EnumeratedPrintQueueTypes[])
Gets the collection of print queues, which are of the specified EnumeratedPrintQueueTypes and are initialized only in the specified properties.
public:
System::Printing::PrintQueueCollection ^ GetPrintQueues(cli::array <System::String ^> ^ propertiesFilter, cli::array <System::Printing::EnumeratedPrintQueueTypes> ^ enumerationFlag);
public System.Printing.PrintQueueCollection GetPrintQueues (string[] propertiesFilter, System.Printing.EnumeratedPrintQueueTypes[] enumerationFlag);
member this.GetPrintQueues : string[] * System.Printing.EnumeratedPrintQueueTypes[] -> System.Printing.PrintQueueCollection
Public Function GetPrintQueues (propertiesFilter As String(), enumerationFlag As EnumeratedPrintQueueTypes()) As PrintQueueCollection
Parameters
- propertiesFilter
- String[]
The names of the queue properties that are initialized.
- enumerationFlag
- EnumeratedPrintQueueTypes[]
An array of values that represent the types of print queues that are returned in the collection.
Returns
A PrintQueueCollection of print queues of the specified types; each print queue has only the specified properties initialized.
Applies to
GetPrintQueues(PrintQueueIndexedProperty[], EnumeratedPrintQueueTypes[])
Gets a collection of print queues of the specified types. These print queues are only initialized in the properties that are specified in the PrintQueueIndexedProperty array.
public:
System::Printing::PrintQueueCollection ^ GetPrintQueues(cli::array <System::Printing::PrintQueueIndexedProperty> ^ propertiesFilter, cli::array <System::Printing::EnumeratedPrintQueueTypes> ^ enumerationFlag);
public System.Printing.PrintQueueCollection GetPrintQueues (System.Printing.PrintQueueIndexedProperty[] propertiesFilter, System.Printing.EnumeratedPrintQueueTypes[] enumerationFlag);
member this.GetPrintQueues : System.Printing.PrintQueueIndexedProperty[] * System.Printing.EnumeratedPrintQueueTypes[] -> System.Printing.PrintQueueCollection
Public Function GetPrintQueues (propertiesFilter As PrintQueueIndexedProperty(), enumerationFlag As EnumeratedPrintQueueTypes()) As PrintQueueCollection
Parameters
- propertiesFilter
- PrintQueueIndexedProperty[]
The properties that the constructor initializes.
- enumerationFlag
- EnumeratedPrintQueueTypes[]
An array of values that represent the types of print queues in the collection.
Returns
The PrintQueueCollection of the print server.
Remarks
The queues in the collection are only initialized in the properties that are listed in the PrintQueueIndexedProperty array.
Applies to
GetPrintQueues(String[])
Gets a collection of print queues that are hosted by the print server and that are initialized only in the specified properties.
public:
System::Printing::PrintQueueCollection ^ GetPrintQueues(cli::array <System::String ^> ^ propertiesFilter);
public System.Printing.PrintQueueCollection GetPrintQueues (string[] propertiesFilter);
member this.GetPrintQueues : string[] -> System.Printing.PrintQueueCollection
Public Function GetPrintQueues (propertiesFilter As String()) As PrintQueueCollection
Parameters
- propertiesFilter
- String[]
The names of the queue properties that are initialized.
Returns
The PrintQueueCollection of print queues on the print server; each print queue is initialized only in the properties that are specified in propertiesFilter
.
Applies to
GetPrintQueues(EnumeratedPrintQueueTypes[])
Gets the collection of print queues of the specified types that are named in EnumeratedPrintQueueTypes and hosted by the print server.
public:
System::Printing::PrintQueueCollection ^ GetPrintQueues(cli::array <System::Printing::EnumeratedPrintQueueTypes> ^ enumerationFlag);
public System.Printing.PrintQueueCollection GetPrintQueues (System.Printing.EnumeratedPrintQueueTypes[] enumerationFlag);
member this.GetPrintQueues : System.Printing.EnumeratedPrintQueueTypes[] -> System.Printing.PrintQueueCollection
Public Function GetPrintQueues (enumerationFlag As EnumeratedPrintQueueTypes()) As PrintQueueCollection
Parameters
- enumerationFlag
- EnumeratedPrintQueueTypes[]
An array of values that represent the types of print queues that are in the collection.
Returns
The PrintQueueCollection of print queues, of the specified types, on the print server.
Examples
The following example shows how to use this method to get a subset of available print queues.
// Specify that the list will contain only the print queues that are installed as local and are shared
array<System::Printing::EnumeratedPrintQueueTypes>^ enumerationFlags = {EnumeratedPrintQueueTypes::Local,EnumeratedPrintQueueTypes::Shared};
LocalPrintServer^ printServer = gcnew LocalPrintServer();
//Use the enumerationFlags to filter out unwanted print queues
PrintQueueCollection^ printQueuesOnLocalServer = printServer->GetPrintQueues(enumerationFlags);
Console::WriteLine("These are your shared, local print queues:\n\n");
for each (PrintQueue^ printer in printQueuesOnLocalServer)
{
Console::WriteLine("\tThe shared printer " + printer->Name + " is located at " + printer->Location + "\n");
}
Console::WriteLine("Press enter to continue.");
Console::ReadLine();
// Specify that the list will contain only the print queues that are installed as local and are shared
EnumeratedPrintQueueTypes[] enumerationFlags = {EnumeratedPrintQueueTypes.Local,
EnumeratedPrintQueueTypes.Shared};
LocalPrintServer printServer = new LocalPrintServer();
//Use the enumerationFlags to filter out unwanted print queues
PrintQueueCollection printQueuesOnLocalServer = printServer.GetPrintQueues(enumerationFlags);
Console.WriteLine("These are your shared, local print queues:\n\n");
foreach (PrintQueue printer in printQueuesOnLocalServer)
{
Console.WriteLine("\tThe shared printer " + printer.Name + " is located at " + printer.Location + "\n");
}
Console.WriteLine("Press enter to continue.");
Console.ReadLine();
' Specify that the list will contain only the print queues that are installed as local and are shared
Dim enumerationFlags() As EnumeratedPrintQueueTypes = {EnumeratedPrintQueueTypes.Local, EnumeratedPrintQueueTypes.Shared}
Dim printServer As New LocalPrintServer()
'Use the enumerationFlags to filter out unwanted print queues
Dim printQueuesOnLocalServer As PrintQueueCollection = printServer.GetPrintQueues(enumerationFlags)
Console.WriteLine("These are your shared, local print queues:" & vbLf & vbLf)
For Each printer As PrintQueue In printQueuesOnLocalServer
Console.WriteLine(vbTab & "The shared printer " & printer.Name & " is located at " & printer.Location & vbLf)
Next printer
Console.WriteLine("Press enter to continue.")
Console.ReadLine()
Applies to
GetPrintQueues()
Gets the collection of print queues that the print server hosts.
public:
System::Printing::PrintQueueCollection ^ GetPrintQueues();
public System.Printing.PrintQueueCollection GetPrintQueues ();
member this.GetPrintQueues : unit -> System.Printing.PrintQueueCollection
Public Function GetPrintQueues () As PrintQueueCollection
Returns
The PrintQueueCollection of print queues on the print server.
Examples
The following example shows how to use this method to list the print queues hosted by a PrintServer.
// Create a PrintServer
// "theServer" must be a print server to which the user has full print access.
PrintServer myPrintServer = new PrintServer(@"\\theServer");
// List the print server's queues
PrintQueueCollection myPrintQueues = myPrintServer.GetPrintQueues();
String printQueueNames = "My Print Queues:\n\n";
foreach (PrintQueue pq in myPrintQueues)
{
printQueueNames += "\t" + pq.Name + "\n";
}
Console.WriteLine(printQueueNames);
Console.WriteLine("\nPress Return to continue.");
Console.ReadLine();
' Create a PrintServer
' "theServer" must be a print server to which the user has full print access.
Dim myPrintServer As New PrintServer("\\theServer")
' List the print server's queues
Dim myPrintQueues As PrintQueueCollection = myPrintServer.GetPrintQueues()
Dim printQueueNames As String = "My Print Queues:" & vbLf & vbLf
For Each pq As PrintQueue In myPrintQueues
printQueueNames &= vbTab & pq.Name & vbLf
Next pq
Console.WriteLine(printQueueNames)
Console.WriteLine(vbLf & "Press Return to continue.")
Console.ReadLine()
Applies to
GetPrintQueues(PrintQueueIndexedProperty[])
Gets a collection of print queues that are hosted by the print server and initialized only in the properties that are specified in the PrintQueueIndexedProperty array.
public:
System::Printing::PrintQueueCollection ^ GetPrintQueues(cli::array <System::Printing::PrintQueueIndexedProperty> ^ propertiesFilter);
public System.Printing.PrintQueueCollection GetPrintQueues (System.Printing.PrintQueueIndexedProperty[] propertiesFilter);
member this.GetPrintQueues : System.Printing.PrintQueueIndexedProperty[] -> System.Printing.PrintQueueCollection
Public Function GetPrintQueues (propertiesFilter As PrintQueueIndexedProperty()) As PrintQueueCollection
Parameters
- propertiesFilter
- PrintQueueIndexedProperty[]
The properties that the constructor initializes.
Returns
A PrintQueueCollection whose members are initialized only in the properties specified by propertiesFilter
.