c# - Unable to move file: The process cannot access the file because it is being used by another process -
c# - Unable to move file: The process cannot access the file because it is being used by another process -
scenario: i've written application open list of .msg files (which have been dumped file system), grab info them (subject, cc) , move them.
problem: however, when comes moving file next error:
the process cannot access file because beingness used process.
running handle against file shows tool i've written , no other handles.
i assume, therefore, i'm not releasing files when i've finished using them redemption messageitem objects.
but can't wrap them in using statement, because don't implement idisposable. , don't expose public close or dispose or named methods.
in short, i'm trying ask:
a) how can forcefulness c# application close given handle, knowing path file handle?
or
b) there way forcefulness redemption objects close?
var util = new mapiutilsclass(); messageitem item = util.getitemfrommsgfile(emailpath, false); item.import(emailpath, 3); subject = item.subject; = (item.sendername.length < 96) ? item.sendername : item.sendername.substring(0, 93) + "..."; = (string.isnullorempty(item.to)) ? string.empty : (item.to.length < 96) ? item.to : item.to.substring(0, 93) + "..."; cc = (string.isnullorempty(item.cc)) ? string.empty : (item.cc.length < 96) ? item.cc : item.cc.substring(0, 93) + "..."; sent = item.senton; received = item.receivedtime; log.write("redemption: email info harvested" + emailpath);
do not utilize mapiutils.getitemfrommsgfile - deprecated. utilize rdosession.getmessagefrommsgfile (or createmessagefrommsgfile) - returns irdomail object back upwards idisposable.
c# .net outlook outlook-redemption
Comments
Post a Comment