Skip to main content

Posts

Showing posts with the label file create

Code to create file in folder in Axapta

You can create file in folder using below code in Axapta. Just type code in job and run that job then you can check test.txt file get created in temp folder of c drive. WinAPIServer::WS_FileCreate(@'c:\temp\test.txt'); In WinAPIServer class you can check code in bus layer in WS_FileCreate method. Com oFileSystem; COMVariant varFile; InteropPermission perm; boolean b; ; varFile = new COMVariant(COMVariantInOut::OUT, COMVariantType::VT_BSTR); varfile.bStr(_InFile); perm = new InteropPermission(InteropKind::ComInterop); if (perm == null) { return null; } perm.assert(); oFileSystem = new COM('Scripting.FileSystemObject'); return oFileSystem.CreateTextFile(varFile);