Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Getting list of printers in c# with manage printers rights for currently login user

$
0
0

Hi,

I want to get a list of printers those have manage printers rights in printer security tab for currently login user. Following code give me list of all printers installed over a printer server, but i want to filter them out on the basis of user permissions for currently login user.

private DataTable getPrinterList()

        {
            PrintServer myPrintServer = new PrintServer("\\\\printservername.mydomain.net");
            DataTable dt = new DataTable();
            dt.Columns.Add("Name", typeof(string));
            dt.Columns.Add("FullName", typeof(string));
            dt.Columns.Add("Description", typeof(string));
            dt.Columns.Add("Status", typeof(string));
            dt.Columns.Add("NoOfJobs", typeof(int));

            // List the print server's queues
            PrintQueueCollection myPrintQueues = myPrintServer.GetPrintQueues();
            foreach (PrintQueue pq in myPrintQueues)
            {
                DataRow dr = dt.NewRow();
                dr[0] = pq.Name;
                dr[1] = pq.FullName;
                dr[2] = pq.Description;
                dr[3] = pq.QueueStatus;
                dr[4]= pq.NumberOfJobs;
                dt.Rows.Add(dr);
            }
            return dt;
        }

Waiting for your reply please



Viewing all articles
Browse latest Browse all 31927

Trending Articles