How to find out if a user has access rights (for example, printing, document management) on a network printer in C #

I want to know if a user has access rights on a network printer or not. My scenario is I use the system.printing library to get information about the printer, but when I try to create a Printqueue object, the following statement never completed its execution. here is a sample code for it

PrintServer printServer = new PrintServer(@"\\" + printServerName);
PrintQueue printQueue = printServer.GetPrintQueue(printerName);

The second statement never completes if the network printer does not have user rights. Therefore, before doing this, I want to know whether it is possible to check the rights on the printer. Please let me know that someone is facing this problem and have any solution for this.

+4
source share

Source: https://habr.com/ru/post/1547749/


All Articles