Monday, January 11, 2016

AX 2012: File existance check

Multiple ways to check file existance in AX 2012;

Client side check, does not work with batch job

WinAPI::fileExists(_fileName);

Server side check which works for run base batch too

public boolean getFileExists(filepath _fileName)
{
   System.IO.FileInfo   fileInfo;
   new InteropPermission(InteropKind::ClrInterop).assert();
   fileInfo = new System.IO.FileInfo(_fileName);
   return fileInfo.get_Exists();

}

No comments:

Post a Comment

I will appreciate your comments !

How to enable new Microsoft teams - Public Preview!

New Microsoft Teams is just AWESOME, quick but useful post below shows how you have this preview feature to make your life EASY!  Open Micr...