Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET Objects

 AfterLogic Forum : MailBee.NET Objects
Subject Topic: Save attachments preserving timestamps ? Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
juris
Groupie
Groupie


Joined: 27 June 2011
Location: Italy
Online Status: Offline
Posts: 72
Posted: 17 February 2015 at 9:12am | IP Logged Quote juris

Hello support,

How I save attachments and preserve timestamps?


foreach (Attachment attach in msg.Attachments)
{
    // This changes the timestamps!!
    attach.Save(@"C:\Temp\" + attach.Filename, true);
}

================[ I want result like this...] ================================

static void CopyFileExactly(string copyFromPath, string copyToPath)
    {
        var origin = new FileInfo(copyFromPath);

        origin.CopyTo(copyToPath, true);

        var destination = new FileInfo(copyToPath);
        destination.CreationTime = origin.CreationTime;
        destination.LastWriteTime = origin.LastWriteTime;
        destination.LastAccessTime = origin.LastAccessTime;
    }

===================================================================
Back to Top View juris's Profile Search for other posts by juris
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 17 February 2015 at 10:23am | IP Logged Quote Alex

I don't understand this. Timestamp makes sense for a file, not for attachment. Attachment is just a MIME part in a mail message. It does not have any timestamp associated with it. When you save an attachment into a file, the file gets timestamp of the moment of saving because there is no other timestamp which could have been used for that.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
juris
Groupie
Groupie


Joined: 27 June 2011
Location: Italy
Online Status: Offline
Posts: 72
Posted: 17 February 2015 at 1:29pm | IP Logged Quote juris

Hello Alex,

Thanks for the reply

Lello
Back to Top View juris's Profile Search for other posts by juris
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide