DIR Return Create A Forum - Home
---------------------------------------------------------
social facebook
HTML https://socialfacebook.createaforum.com
---------------------------------------------------------
*****************************************************
DIR Return to: Social Facebook
*****************************************************
#Post#: 83--------------------------------------------------
How to: Enumerate a Subset of Print Queues
By: eyeconic Date: April 5, 2018, 9:47 am
---------------------------------------------------------
A common situation faced by information technology (IT)
professionals managing a company-wide set of printers is to
generate a list of printers having certain characteristics. This
functionality is provided by the GetPrintQueues method of a
PrintServer object and the EnumeratedPrintQueueTypes
enumeration.
Example
In the example below, the code begins by creating an array of
flags that specify the characteristics of the print queues we
want to list. In this example, we are looking for print queues
that are installed locally on the print server and are shared.
The EnumeratedPrintQueueTypes enumeration provides many other
possibilities.
The code then creates a LocalPrintServer object, a class derived
from PrintServer. The local print server is the computer on
which the application is running.
The last significant step is to pass the array to the
GetPrintQueues method.
Finally, the results are presented to the user.
C# Copy
// 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();
You could extend this example by having the foreach loop that
steps through each print queue do further screening. For
example, you could screen out printers that do not support
two-sided printing by having the loop call each print queue's
GetPrintCapabilities method and test the returned value for the
presence of duplexing.
HTML https://www.youtube.com/watch?v=bGC2fNALbNU
<script>
(function() {
var cx = '017846004531943245215:ntog6z4xfuc';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = '
HTML https://cse.google.com/cse.js?cx='
+ cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:search></gcse:search>
*****************************************************