PrintServer.GetPrintQueues 方法

定义

获取打印服务器承载的打印队列的集合。

重载

GetPrintQueues(String[], EnumeratedPrintQueueTypes[])

获取打印队列的集合,这些队列属于指定的 EnumeratedPrintQueueTypes,并且仅在指定属性中初始化。

GetPrintQueues(PrintQueueIndexedProperty[], EnumeratedPrintQueueTypes[])

获取指定类型的打印队列的集合。 这些打印队列仅在 PrintQueueIndexedProperty 数组中指定的属性中初始化。

GetPrintQueues(String[])

获取打印服务器托管的打印队列的集合,这些队列仅在指定属性中初始化。

GetPrintQueues(EnumeratedPrintQueueTypes[])

获取在 EnumeratedPrintQueueTypes 中命名并由打印服务器托管的指定类型的打印队列的集合。

GetPrintQueues()

获取打印服务器承载的打印队列的集合。

GetPrintQueues(PrintQueueIndexedProperty[])

获取打印服务器托管的打印队列的集合,这些队列仅在 PrintQueueIndexedProperty 数组中指定的属性中初始化。

GetPrintQueues(String[], EnumeratedPrintQueueTypes[])

获取打印队列的集合,这些队列属于指定的 EnumeratedPrintQueueTypes,并且仅在指定属性中初始化。

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

参数

propertiesFilter
String[]

初始化的队列属性的名称。

enumerationFlag
EnumeratedPrintQueueTypes[]

一个值数组,表示集合中返回的打印队列的类型。

返回

指定类型的打印队列 PrintQueueCollection;每个打印队列只初始化了指定的属性。

适用于

GetPrintQueues(PrintQueueIndexedProperty[], EnumeratedPrintQueueTypes[])

获取指定类型的打印队列的集合。 这些打印队列仅在 PrintQueueIndexedProperty 数组中指定的属性中初始化。

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

参数

propertiesFilter
PrintQueueIndexedProperty[]

构造函数初始化的属性。

enumerationFlag
EnumeratedPrintQueueTypes[]

一个值数组,表示集合中打印队列的类型。

返回

打印服务器的 PrintQueueCollection

注解

集合中的队列仅在 PrintQueueIndexedProperty 数组中列出的属性中初始化。

适用于

GetPrintQueues(String[])

获取打印服务器托管的打印队列的集合,这些队列仅在指定属性中初始化。

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

参数

propertiesFilter
String[]

初始化的队列属性的名称。

返回

打印服务器上的打印队列 PrintQueueCollection;每个打印队列仅在 propertiesFilter中指定的属性中初始化。

适用于

GetPrintQueues(EnumeratedPrintQueueTypes[])

获取在 EnumeratedPrintQueueTypes 中命名并由打印服务器托管的指定类型的打印队列的集合。

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

参数

enumerationFlag
EnumeratedPrintQueueTypes[]

一个值数组,表示集合中打印队列的类型。

返回

打印服务器上的指定类型的打印队列 PrintQueueCollection

示例

以下示例演示如何使用此方法获取可用打印队列的子集。

// 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()

适用于

GetPrintQueues()

获取打印服务器承载的打印队列的集合。

public:
 System::Printing::PrintQueueCollection ^ GetPrintQueues();
public System.Printing.PrintQueueCollection GetPrintQueues ();
member this.GetPrintQueues : unit -> System.Printing.PrintQueueCollection
Public Function GetPrintQueues () As PrintQueueCollection

返回

打印服务器上的打印队列 PrintQueueCollection

示例

以下示例演示如何使用此方法列出由 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()

适用于

GetPrintQueues(PrintQueueIndexedProperty[])

获取打印服务器托管的打印队列的集合,这些队列仅在 PrintQueueIndexedProperty 数组中指定的属性中初始化。

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

参数

propertiesFilter
PrintQueueIndexedProperty[]

构造函数初始化的属性。

返回

一个 PrintQueueCollection,其成员仅在 propertiesFilter指定的属性中初始化。

适用于