Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to move file: The process cannot access the file because it is being used by another process
    primarykey
    data
    text
    <p>Scenario: I've written an application to open a list of .msg files (which have been dumped to the file system), grab some information from them (subject, To CC) and then move them. </p> <p>Problem: However, when it comes to moving the file I get the following error:</p> <blockquote> <p>The process cannot access the file because it is being used by another process.</p> </blockquote> <p>Running Handle against the file only shows the tool I've written and no other handles. </p> <p>I assume, therefore, that I'm not properly releasing the files when I've finished using them as Redemption MessageItem objects. </p> <p>But I can't wrap them in a using statement, because they don't implement IDisposable. And they don't expose any public Close or Dispose or similarly named methods.</p> <p><br> <br></p> <p>In short, I'm trying to ask: </p> <p>a) How can I force my c# application to close a given handle, knowing only the path to the file handle?</p> <p>Or</p> <p>b) Is there a way to force the Redemption objects to close?</p> <pre><code>var util = new MAPIUtilsClass(); MessageItem item = util.GetItemFromMsgFile(EmailPath, false); item.Import(EmailPath, 3); Subject = item.Subject; From = (item.SenderName.Length &lt; 96) ? item.SenderName : item.SenderName.Substring(0, 93) + "..."; To = (String.IsNullOrEmpty(item.To)) ? String.Empty : (item.To.Length &lt; 96) ? item.To : item.To.Substring(0, 93) + "..."; CC = (String.IsNullOrEmpty(item.CC)) ? String.Empty : (item.CC.Length &lt; 96) ? item.CC : item.CC.Substring(0, 93) + "..."; Sent = item.SentOn; Received = item.ReceivedTime; Log.Write("Redemption: Email data harvested" + EmailPath); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload