AX2012 X++ code to read the text file

//Create a new job and paste the code
static void RB_ReadTextFile(Args _args)
{
    Filename                                              filename = @'C:\Desktop\AX2012.txt';
    System.IO.StreamReader          reader;
    System.String                                   line;
    InteropPermission                       interopPermission;
    Str                                                         text;

    interopPermission = new InteropPermission(InteropKind::ClrInterop);
    interopPermission.assert();

    reader = new System.IO.StreamReader(filename,System.Text.Encoding::get_UTF8());
    line = reader.ReadLine();

    while (!System.String::IsNullOrEmpty(line))
    {
        line = reader.ReadLine();
        text = line;
        info(strfmt("%1", text));
    }

    reader.Close();
    reader.Dispose();
}

No comments:

Post a Comment

D365 F&O Release Pipeline Step by Step Configuration Without ISV's

  Step-by-Step Guide: Creating D365FO Build and Deploy Pipelines Azure DevOps Build Pipeline I will walk through the standard procedures...