Copy data from one file to another through X++:

Hi,
To copy data from one file to another file.

static void MyServerFunction(args _args)
{
Filename filename =”D:\\hi.txt”;
TextBuffer txtb = new TextBuffer();
FileIOPermission fileIOPermission = new fileIOPermission(filename,’rw’);
Filename f = “D:\\bye.txt”;
;

fileIOPermission.assert();
// From file will demand CAS permission (read)
txtb.fromFile(filename); // Read text from file
// To clipboard will demand CAS permission (write)
txtb.toClipboard(); // Copy it to the clipboard
// To file will demand CAS permission (write)
txtb.toFile(f); // Write text to file
}

Advertisements

One thought on “Copy data from one file to another through X++:

  1. I needed to write you one tiny note to finally say thanks a lot again relating to the remarkable advice you’ve provided on this site. It was really pretty open-handed with people like you giving openly what exactly a lot of people might have advertised as an e-book to earn some dough for themselves, primarily seeing that you could have tried it in the event you desired. These tips as well acted to become a good way to realize that other people have the same keenness the same as my own to learn good deal more in regard to this issue. I’m sure there are many more enjoyable periods up front for individuals that scan through your blog post.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s