I have client app that I am working on that is supposed to be able to manage print queues, such as resuming print jobs or purging jobs that have hung up. The problem I am running in to is that I need to open the queue with appropriate rights to do that management.
The exact error message I am getting is:
{"An exception occurred while populating the properties for the PrintQueue object. Win32 error: Access is denied."}
I am using the line below to create the queue.
pq = new PrintQueue(ps, printQueue, PrintSystemDesiredAccess.AdministratePrinter);
However, this line returns an access denied. I am an admin on the local box, so I can't image why I am having this issue.
If I open the queue like this:
pq = new PrintQueue(ps, printQueue);
The open works find, but when I try to access the jobs in that queue, I get the access denied message.
Any idea what I am doing wrong here? Any help would be greatly appreciated.