Using system.printing namespace to get print queue status
-
Hi I'm trying to use the system.printing namespace to get the status of print queues on a print server. Unfortunately the only status I ever get for any queue is "None". Here's the code:
dim myPS as PrintServer = New PrintServer("servername")
dim myPrintQueues as PrintQueueCollection = myPS.GetPrintQueues()For Each pq as PrintQueue in myPrintQueues
pq.refresh()
'output pq.name
'output pq.QueueStatus.ToString
NextI must be missing something obvious. Can anyone give me a pointer. I previously posted this question to the .NET framework forum with no luck so reposting here. Thanks.
-
Hi I'm trying to use the system.printing namespace to get the status of print queues on a print server. Unfortunately the only status I ever get for any queue is "None". Here's the code:
dim myPS as PrintServer = New PrintServer("servername")
dim myPrintQueues as PrintQueueCollection = myPS.GetPrintQueues()For Each pq as PrintQueue in myPrintQueues
pq.refresh()
'output pq.name
'output pq.QueueStatus.ToString
NextI must be missing something obvious. Can anyone give me a pointer. I previously posted this question to the .NET framework forum with no luck so reposting here. Thanks.
The code looks good, though I can't test it right now. There are two possibilities. The user account you're running the code under does have sufficient permissions to get the print queue status, which is unlikely. And, the printer driver is under no obligation to update the status with the print server. So, it's entirely possible that the status really is None, even though it's doing something.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008