Skip to main content

Posts

Showing posts with the label Send message from one computer to other by Dynamics axapta code

Send message from one computer to other by MS Dynamics axapta code

To Send message from one computer to other by Dynamics axapta code you can try following code in ax job. COM netSendComObj; InteropPermission InteropPermission1 = new InteropPermission(InteropKind::ComInterop); int Result; str NameOfMachine = Winapi::getComputerName(); str MSG = ‘Hello how are you.Do you know me I am Dynamics AX’; InteropPermission1.assert(); try { netSendComObj = new COM("WScript.Shell"); Result = netSendComObj.Run(strFmt("net send %1 %2", NameOfMachine, MSG),0,true); } catch (Exception::Error) { CodeAccessPermission::revertAssert(); throw Exception::Error; } if (Result != 0) { warning(strfmt(‘Sending message Failed’, NameOfMachine)); warning(‘Check messenger service is Started’); } CodeAccessPermission::revertAssert();