Microsoft Dynamics NAV
---------------------------
A call to System.__ComObject.MoveFile failed with this message: Exception from HRESULT: 0x800A0046 (CTL_E_PERMISSIONDENIED)
---------------------------
OK
---------------------------
code:
CREATE(FSO,FALSE,TRUE);
FSO.MoveFile('D:\INTERFACE FILES\UAT\CLIENTS\PRIMARY\'+RecErrorLog."File Name"+'.txt','D:\INTERFACE FILES\UAT\CLIENTS\ERROR\');
Name DataType Subtype
FSO Automation ' Windows Script Host Object Model'.FileSystemObject
i am not able to move when it use in one codeunit1but with other codeunit2 it works do't know why?
codeunit 1
IF NOT codeunit50010.RUN THEN
//MESSAGE('The last error was: ' + GETLASTERRORTEXT);
BEGIN
RecErrorLog.INIT;
RecErrorLog."No.":= Srno;
RecErrorLog."Error Message":= GETLASTERRORTEXT;
//RecErrorLog."Source Type" :=
RecErrorLog.Date := TODAY;
RecErrorLog.Time :=TIME;
RecErrorLog."File Name":=codeunit50010.GetErrorFileName;
RecErrorLog.INSERT;
CREATE(FSO,FALSE,TRUE);
FSO.MoveFile('D:\INTERFACE FILES\UAT\CLIENTS\PRIMARY\'+RecErrorLog."File Name"+'.txt','D:\INTERFACE FILES\UAT\CLIENTS\ERROR\');//Not Working
Srno :=Srno+1;
MESSAGE('Runner codeunit Run Successfully');
END;
codeunit 2
XmlportCMU50003.SetSourceType(SourceTypeGlobal);
XmlportCMU50003.GetFileName(Filepath);
FileName:=XmlportCMU50003.GetInterfaceFileName;
SetErrorFileName(ErrorFileName);
CREATE(FSO,FALSE,TRUE);
FSO.MoveFile('D:\INTERFACE FILES\UAT\CLIENTS\PRIMARY\'+GetErrorFileName+'.txt','D:\INTERFACE FILES\UAT\CLIENTS\ERROR\');//working
//MESSAGE(FORMAT(GetErrorFileName));
varXmlFile.OPEN(Filepath);
varXmlFile.CREATEINSTREAM(varInputStream);
XMLPORT.IMPORT(XMLPORT::"Client Invoice - Header", varInputStream);