Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

PrintServer Class

Manages the print queues on a print server, which is usually a computer, but can be a dedicated hardware print server appliance.

Namespace:  System.Printing
Assembly:  System.Printing (in System.Printing.dll)
public class PrintServer : PrintSystemObject

The PrintServer type exposes the following members.

  NameDescription
Public methodPrintServer()Initializes a new instance of the PrintServer class.
Public methodPrintServer(PrintSystemDesiredAccess)Initializes a new instance of the PrintServer class that represents the local print server and assigns it the specified PrintSystemDesiredAccess.
Public methodPrintServer(String)Initializes a new instance of the PrintServer class that has the specified path.
Public methodPrintServer(String, PrintServerIndexedProperty[])Initializes a new instance of the PrintServer class by using the specified PrintServerIndexedProperty array to determine which properties will be initialized.
Public methodPrintServer(String, PrintSystemDesiredAccess)Initializes a new instance of the PrintServer class that has the specified path and the needed access.
Public methodPrintServer(String, String[])Initializes a new instance of the PrintServer class that has the specified path and properties filter.
Public methodPrintServer(String, PrintServerIndexedProperty[], PrintSystemDesiredAccess)Initializes a new instance of the PrintServer class and provides the specified path, the PrintServerIndexedProperty array, and the needed access.
Public methodPrintServer(String, String[], PrintSystemDesiredAccess)Initializes a new instance of the PrintServer class that has the specified path, properties filter, and the needed access.
Top
  NameDescription
Public propertyBeepEnabledGets or sets a value that indicates whether the print server beeps in response to an error condition in the printer.
Public propertyDefaultPortThreadPriorityInfrastructure. Do not use.
Public propertyDefaultSchedulerPriorityInfrastructure. Do not use.
Public propertyDefaultSpoolDirectoryGets or sets the path where the print server's spool files are located.
Public propertyEventLogGets or sets the type of events that the print server logs.
Protected propertyIsDelayInitializedGets or sets a value that indicates whether initialization of the PrintServer properties has been postponed.
Protected propertyIsDisposedGets or sets a value that indicates whether the object has been disposed. (Inherited from PrintSystemObject.)
Public propertyMajorVersionGets the major version of the operating system.
Public propertyMinorVersionGets the minor version within the major version of the operating system.
Public propertyNameGets the name of the print server. (Overrides PrintSystemObject.Name.)
Public propertyNetPopupGets or sets a value that indicates whether notifications that a print job has finished are sent to either the print server or the client computer.
Public propertyParentGets the parent of the object. (Inherited from PrintSystemObject.)
Public propertyPortThreadPriorityGets or sets the thread priority for the process that manages I/O through the printer ports.
Public propertyPropertiesCollectionGets a collection of attribute and value pairs. (Inherited from PrintSystemObject.)
Public propertyRestartJobOnPoolEnabledGets or sets a value that indicates whether users can restart jobs after an error occurs if printer pooling is enabled.
Public propertyRestartJobOnPoolTimeoutGets or sets a value that indicates the wait time before a job can be restarted, if an error occurs when printer pooling is also enabled.
Public propertySchedulerPriorityGets or sets the thread priority for the process that routes print jobs from applications to print queues.
Public propertySubSystemVersionGets the version of the print spooler system.
Top
  NameDescription
Public methodCommitCommits any changes that your program made to the properties of the print server object by writing them to the print server that the object represents. (Overrides PrintSystemObject.Commit().)
Public methodStatic memberDeletePrintQueue(PrintQueue)Removes the specified PrintQueue from the print server.
Public methodStatic memberDeletePrintQueue(String)Removes the print queue with the specified name from the print server.
Public methodDispose()Releases all resources used by the PrintSystemObject. (Inherited from PrintSystemObject.)
Protected methodDispose(Boolean)Releases the unmanaged resources used by the PrintSystemObject and optionally releases the managed resources. (Inherited from PrintSystemObject.)
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeReleases the resources that are being used by the PrintSystemObject. (Inherited from PrintSystemObject.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetPrintQueue(String)Obtains a reference to the named print queue from the print server.
Public methodGetPrintQueue(String, String[])Gets a specified print queue from the print server.
Public methodGetPrintQueues()Gets the collection of print queues that the print server hosts.
Public methodGetPrintQueues(EnumeratedPrintQueueTypes[])Gets the collection of print queues of the specified types that are named in EnumeratedPrintQueueTypes and hosted by the print server.
Public methodGetPrintQueues(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 methodGetPrintQueues(String[])Gets a collection of print queues that are hosted by the print server and that are initialized only in the specified properties.
Public methodGetPrintQueues(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 methodGetPrintQueues(String[], EnumeratedPrintQueueTypes[])Gets the collection of print queues, which are of the specified EnumeratedPrintQueueTypes and are initialized only in the specified properties.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodInitializeInitializes the properties of the PrintSystemObject. (Inherited from PrintSystemObject.)
Public methodInstallPrintQueue(String, String, String[], String, PrintPropertyDictionary)Installs a print queue, and associated printer driver, on the print server.
Public methodInstallPrintQueue(String, String, String[], String, PrintQueueAttributes)Installs a print queue, and associated printer driver, on the print server.
Public methodInstallPrintQueue(String, String, String[], String, PrintQueueAttributes, PrintQueueStringProperty, Int32, Int32)Installs a prioritized print queue, and associated printer driver, on the print server.
Public methodInstallPrintQueue(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.
Protected methodInternalDisposeReleases the unmanaged resources that are used by the PrintServer and optionally releases the managed resources. (Overrides PrintSystemObject.InternalDispose(Boolean).)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodRefreshUpdates the properties of the PrintServer object so that each property value matches the corresponding attribute value of the print server that the object represents. (Overrides PrintSystemObject.Refresh().)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

When your program writes a value to a property of PrintServer, that change has no effect until it is passed on to the computer that is represented by the PrintServer object. To commit changes, use the Commit method for the object.

Similarly, other applications may change the actual print service properties of the computer. To make sure that the PrintServer object for your program has the latest values, use the Refresh method for the object.

Caution noteCaution

Classes within the System.Printing namespace are not supported for use within a Windows service or ASP.NET application or service. Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions.

If you want to print from a Windows Forms application, see the System.Drawing.Printing namespace.

The following example shows how to create an instance of 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();

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft. All rights reserved.