I am having much trouble getting a collection of jobs when connecting
to an IPP Printer queue using system.printing namespace. I would
appreciate any help here.
I am getting the error:
"Year, Month, and Day parameters describe an un-representable
DateTime."
when I try the following code:
''' -- code start
Dim myPrintServer As PrintServer = New PrintServer()
Dim enumerationFlags As EnumeratedPrintQueueTypes() =
{EnumeratedPrintQueueTypes.Local,
EnumeratedPrintQueueTypes.Connections}
Dim myPrintQueues = myPrintServer.GetPrintQueues(enumerationFlags)
For Each pq As PrintQueue In myPrintQueues
pq.Refresh()
Dim jobs As PrintJobInfoCollection = pq.GetPrintJobInfoCollection()
For Each job As PrintSystemJobInfo In jobs
''and so on...
''' -- code end
and here is my stack trace:
StackTrace: at System.DateTime.DateToTicks(Int32 year, Int32 month,
Int32 day)
at
MS.Internal.PrintWin32Thunk.DirectInteropForJob.JobInfoTwo.GetTimeSubmitted
(_JOB_INFO_2W* unmanagedPrinterInfo)
at
MS.Internal.PrintWin32Thunk.DirectInteropForJob.JobInfoTwo.GetValueFromName
(String name, UInt32 index)
at
MS.Internal.PrintWin32Thunk.AttributeNameToInfoLevelMapping.InfoLevelThunk.GetValueFromInfoData
(String valueName, UInt32 index)
at
MS.Internal.PrintWin32Thunk.EnumDataThunkObject.GetPrintSystemValuesPerPrintJobs
(PrintQueue printQueue, Queue`1 printObjectsCollection, String[]
propertyFilter, UInt32 firstJobIndex, UInt32 numberOfJobs)
at System.Printing.PrintJobInfoCollection..ctor(PrintQueue
printQueue, String[] propertyFilter)
at System.Printing.PrintQueue.GetPrintJobInfoCollection()
at PrintJobRestarter2.PrintJobRestarter2.IteratePrinterQueues() in
C:\testProject.vb:line 61
This error only occurs when i hit an IPP printer, which is an HP
Printer.
Thanks in advance,