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();
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.