fileNameforEmail = winApi::getTempPath() + mail; // store attachment in a
temp location
info(fileNameforEmail);
info(p1.fileName());
if(fileNameforEmail)
{
handle=winapi::createFile(filenameforEmail);
perm = new FileIOPermission(fileNameforEmail,'w');
}
else
throw error("Temp Location unavailable");
winapi::copyFile(p1.fileName(),fileNameforEmail,true);
winapi::closeHandle(handle);
winapi::deleteFile(fileNameforEmail);//This lines give me error (CLR
oBject static method error) because temp file is locked ...not sure why? i
have tried to close the handle to the file but still not able to delete the
file. I have tried del command using msdos but get the error that file is
used by another process.
CodeAccessPermission::revertAssert();
Thanks in advance
--
hs
System.IO.File::Delete(filename)
did you execute this code on server or on client?
If the code runs on server side, you have to use the Class WinApiServer
insted of WinApi.
For more dteails abut this helps check this article:
http://www.artofcreation.be/2009/04/08/winapi-rpc-1702-and-findfirstfilew/
--
Sincerely yours
Axel Kühn (visit my Dynamics AX blog at: http://blog.ak-home.net)