Check attachment delete from filesystem
Views (749)
Hi, could happen (I hope in your case not) that some attachment of Dynamics Ax was deleted from folder from external program.
This little utility check your reference in AX and search in the folder for missing file
static void findAttachmentDeleted(Args _args)
{
docuref dr;
docutype dt;
str 200 _filepath,filename,impfile;
real filehandle;
select dr where dr.RefTableId == tablenum(inventtable);
while(dr.RecId)
{
dt = docutype::find(dr.TypeId);
if(dt.ArchivePath != “”)
{
[fileHandle, fileName] = WinApi::findFirstFile(dt.ArchivePath + “\\” + dr.docuValue().fileName());
if(!fileName)
{
warning(“check on FILESYSTEM the file ” + dt.ArchivePath + “\\” + dr.docuValue().fileName());
}
}
next dr;
}
}
This was originally posted here.

Like
Report
*This post is locked for comments