PrintServer.GetPrintQueues 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得列印伺服器裝載的列印佇列集合。
多載
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
指定之屬性中初始化。