Error 'Object 'CLRObject' could not be created' when run class.

Hi,

i need to upload/download file from another folder (same domain). to do this i write below class and when i run it, ‘error Object ‘CLRObject’ could not be created’ prompt. After debug the program i able to locate the error come from below line

‘directoryInfo = new System.IO.DirectoryInfo(strFilePath);’

may i ask, is it because AX not allowed me to use IO service?

and anyone can help me on this?

Class

static Container ConnectionTest()

{

System.IO.DirectoryInfo directoryInfo;

System.IO.FileInfo fileInfo;

System.Type sysType;

System.Array arrFiles;

FilePath strFilePath;

FileIOPermission filePermission;

InteropPermission interopPermission;

Set permissionSet;

int intPathCnt,

intFileCnt,

intTotalFiles;

container conSourceFiles,

conFiles;

Filename strFullFileName,

strFileName;

#IDS_FA_Integration_Mcr

;

interopPermission = new InteropPermission(InteropKind::ClrInterop);

//source path

conSourceFiles = [#AcquisitionNet];

for (intPathCnt = 1; intPathCnt <= conLen(conSourceFiles); intPathCnt++)

{

strFilePath = conPeek(conSourceFiles, intPathCnt);

filePermission = new FileIOPermission(strFilePath, “R”);

permissionSet = new Set(Types::Class);

permissionSet.add(interopPermission);

permissionSet.add(filePermission);

CodeAccessPermission::assertMultiple(permissionSet);

directoryInfo = new System.IO.DirectoryInfo(strFilePath);

sysType = System.Type::GetType(“System.IO.FileInfo”);

arrFiles = System.Array::CreateInstance(sysType, 1); //1 dimension array.

arrFiles = directoryInfo.GetFiles();

intTotalFiles = arrFiles.get_Length();

CodeAccessPermission::revertAssert();

for (intFileCnt = 0; intFileCnt < intTotalFiles; intFileCnt++)

{

//read directory.

interopPermission = new InteropPermission(InteropKind::ClrInterop);

interopPermission.assert();

fileInfo = arrFiles.GetValue(intFileCnt);

strFullFileName = fileInfo.get_FullName();

CodeAccessPermission::revertAssert();

conFiles += [strFullFileName];

}

}

return conFiles;

}

Hi,

I solved this issue by map the network and make it as shared folder.

[:#]