Created
August 7, 2019 08:43
-
-
Save d47447/0ca983178bc83b675cdbd620f29fafa4 to your computer and use it in GitHub Desktop.
Create and save a csv/text file in D365FO (x++ code sample)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| System.IO.Stream stream; | |
| TextStreamIo io; | |
| System.IO.StreamReader reader; | |
| XML fileContent; | |
| io = TextStreamIo::constructForWrite(); | |
| io.writeExp(str2con(<String value/record>))); | |
| stream = io.getStream(); | |
| stream.Position = 0; | |
| reader = new System.IO.StreamReader(stream); | |
| filecontent = reader.ReadToEnd(); | |
| //save file on local folder | |
| //File::SendStringAsFileToUser(str content, str fileName, System.Text.Encoding encoding = System.Text.Encoding::get_UTF8(), ClassName fileUploadStrategyClassName = classstr(FileUploadTemporaryStorageStrategy)) | |
| File::SendStringAsFileToUser(fileContent, 'MyTextFile'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment