Copy this method to your Global Class in AX.
public static void appendTextFile(str fromFilePath,str toFilePath)
{
FileIOPermission fromPerm;
FileIOPermission toPerm;
System.String text;
System.IO.FileStream fs;
System.IO.StreamReader reader;
;
if(System.IO.File::Exists(fromFilePath) &&
System.IO.File::Exists(toFilePath))
{
// Read text from file
reader = new System.IO.StreamReader(fromFilePath);
text = reader.ReadToEnd();
reader.Close();
// Append
System.IO.File::AppendAllText(toFilePath,text);
}
else
{
throw error("Invalid path or file does not exist");
}
public static void appendTextFile(str fromFilePath,str toFilePath)
{
FileIOPermission fromPerm;
FileIOPermission toPerm;
System.String text;
System.IO.FileStream fs;
System.IO.StreamReader reader;
;
if(System.IO.File::Exists(fromFilePath) &&
System.IO.File::Exists(toFilePath))
{
// Read text from file
reader = new System.IO.StreamReader(fromFilePath);
text = reader.ReadToEnd();
reader.Close();
// Append
System.IO.File::AppendAllText(toFilePath,text);
}
else
{
throw error("Invalid path or file does not exist");
}
}