Hi everyone,
This is driving me nuts.
I retrieve a bunch of emails from a mailbox and save them as files in a folder. There is currently just one mail in the mailbox (this specific mail is not the problem, tried others as well). After retrieval I concatenate the subject of the mail with a unique GUID-string, save it as a file and create another copy of this file in a different folder. This repeatedly gives me an IOException saying that the DESTINATION FILE could not be accessed (since it's allegedly being used by another process). The destination file doesn't exist at this point so it cannot be in use.
Hope anyone can help or maybe give a hint.
Thanks in advance.
Regards, Kevin
EDIT (more info)
private static void _backupMailFile(string sourceFile, string destinationFile)
{
log.Info(String.Format("Archiving mail file '{0}' to '{1}'", sourceFile, destinationFile));
try
{
File.Copy(sourceFile, destinationFile);
}
catch (Exception ex)
{
log.Error("Error while archiving mail: " + sourceFile, ex);
}
}
sourceFile = "D:\Development\POP3toSCSM\POP3toSCSM\bin\Debug\TempMails\AW_ Outlook Web App Light-47459c48-8c8c-4c51-be63-e6e2ddcc54d3.eml"
destinationFile = "C:\MailIn\Archive\AW_ Outlook Web App Light-47459c48-8c8c-4c51-be63-e6e2ddcc54d3.eml"
The folder "C:\MailIn\Archive" is empty at this point.
Permissions are valid.
Thanks again.