I'm attempting to create a PrintServer
using the following code
PrintServer printServer = new PrintServer(@"\\PrinterName");
PrintQueueCollection printQueues = printServer.GetPrintQueues();
foreach(PrintQueue pq in printQueues)
{
Console.WriteLine(pq.Name);
}
but it seems that whatever I put in throws the following exception:
System.Printing.PrintServerException: 'An exception occurred while creating the PrintServer object. Win32 error: The printer name is invalid.'
It may be that I'm putting in the wrong printer name every time, but having tried every possible combination of path I can think of for a few different printers and having the same issue each time I've run out of things to try for this.
I tried following the enabling the Print and Document service as per the advice shown in this question but it hasn't yet helped.