Anybody has use the PrintQueueWatch dll for monitor printJobs and printers.
I'm using the PrintQueueWatch dll for a simple app to monitor printers.
I wanna know how to use the function
PrintJob.Transfer.(string printerName, bool transfer)
The function is for transfer the print job to another printer, It's seems very easy to use, the function needs the printer name and a bool value to keep or not the print job in the original printer
but the problem is that always raises an exception
access denied
printQueueWatch collection = new PrintQueueWatch.PrinterCollection();
PrinterInformation printer = collection.Where(l=>l.printername == "the printer that I'm using")
printer.PrinterJobs.getJobById(Id).Transfer("the printer to transfer the printerJob", false) // false to keep the job in the original Printer.
The transfer function says access denied, it seems permissions to acces the new printer.
Thanks.
Prasad RaveendranPosted Aug 4, 2024, 3:00 AM
The "access denied" exception usually indicates a permissions issue. Here are a few things to check and try:
Printer Permissions: Ensure that your application has the necessary permissions to manage the printers and print jobs. This includes:
Run as Administrator: Run your application with elevated privileges (Run as Administrator) to ensure it has the necessary access rights.
Check Printer Spooler Service: Ensure that the Printer Spooler service is running and that there are no issues with it. Restarting the spooler service might help.
User Account Control (UAC): If UAC is enabled, it might be blocking access. Try running the application with UAC disabled or adjust the UAC settings.
Code Example: Double-check your code for any possible issues. Here’s a refined example:
6. Printer Names: Ensure that the printer names are correct and match exactly with the names in the printer settings, including case sensitivity.
7. Firewall and Network Settings: If the printers are network printers, ensure there are no firewall or network restrictions preventing access.
8. Event Logs: Check the Windows Event Logs (under Application and System logs) for any related errors or warnings that might provide more details on the access denied issue.
If you’ve verified all the above and still face issues, it might be helpful to provide more specific details about the environment and the exact error message for further troubleshooting.