How to Display Printers List using X++ in Ax


Here is the Code that you can get List of Printer using X++. To Create Job and Run the Job and Infolog will Show you Printers List.

staticvoidShowListOfPrinters(Args _args)
{
printJobSettingsprintJobSettings;
sysPrintOptionssysPrintOptions;
mapprinterMap;
mapIteratormapIterator;
    ;
printJobSettings =
SysPrintOptions::newPrintJobSettingsOnServer();
sysPrintOptions = newsysPrintOptions();
sysPrintOptions.setPrintJobSettings(printJobSettings);
sysPrintOptions.buildPrinterMap();
printerMap = sysPrintOptions.getPrinterMap();
mapIterator = newmapIterator(printerMap);
mapIterator.begin();
while (mapIterator.more())
    {
info(mapIterator.value());
mapIterator.next();
    }
}

Related Posts

Previous
Next Post »

Thanks for comments.....