Re: Server Printing using Print Dialog

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



"BrassicaNigra" <brassica_nigra@xxxxxxxxxxxxxxxx> wrote in message news:CB9AC21E-765C-4906-987D-E4155BD72B4D@xxxxxxxxxxxxxxxx

How can I bring up a print dialog box in the client browser that offers the
different printers available to the server?

You can't. Calling a dialog box on the server would pop a dialog box on the server - there will be no-one there to see it...

If that is not possible, is there a way to retrieve the names of the
printers on the server. I could then use the PrintSettings.PrinterName
property to set the output myself

Certainly. Because the code will be running on the server, you have the entire .NET Framework at your disposal. There are several ways you can retrieve the collection of printers installed on the server, but WMI is probably the simplest:

using System.Collections.Generic;
using System.Management;

using (ManagementObjectSearcher objMOS = new ManagementObjectSearcher("SELECT * FROM Win32_Printer"))
{
using (ManagementObjectCollection objMOC = objMOS.Get())
{
foreach (ManagementObject objMO in objMOC)
{
// do something with objMO["Name"]
}
}
}


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

.



Relevant Pages

  • Re: !!HELP!! Pulling my hair on this one. Printer problems. Really need some help on this.
    ... Yes Larry I have already moved them off of the SBS server and onto a high ... When the printers were connecte they did show as being offline. ... have workstations connected are plugged into the same. ...
    (microsoft.public.windows.server.sbs)
  • Re: 2nd Branch Server and Laptop configuration suggestion
    ... please share all printers and folders the laptop user ... This newsgroup only focuses on SBS technical issues. ... now, that way, each branch is independent of any possible Server down at ...
    (microsoft.public.windows.server.sbs)
  • Re: !!HELP!! Pulling my hair on this one. Printer problems. Really need some help on this.
    ... Yes it is becoming a concerning issue with my SBS server. ... When the printers were connecte they did show as being offline. ... It can't be my hub because other wall jacks that have workstations ...
    (microsoft.public.windows.server.sbs)
  • Re: CUPS Server Error
    ... Server Identity ... > # Classification: the classification level of the server. ... the default language if not specified by the browser. ... determines whether the scheduler will allow new printers ...
    (Debian-User)
  • Re: !!HELP!! Pulling my hair on this one. Printer problems. Really need some help on this.
    ... If the server tried to contact a printer and could not, say because of a sporadic hardware issue, it might report the printeras offline. ... I think that what I would do next would be to delete all the printers, then go into Server Properties and delete all the drivers. ... So I think for now if I can resolve the issue as to why I cannot remove and delete the print queues from my SBS server then I can try to reinstall from scratch without the existing print queues still in place. ... By centralizing the spooler you can control access, do "grouped" deployments, such as department/building/remote printer locations using group policy, upgrade a driver on the server and have all workstations get the new driver automatically, and...ultimately...usually a better troubleshooting experience when problems arise because you know the driver, the port, and don't have several workstations with different configurations floating out there. ...
    (microsoft.public.windows.server.sbs)