Domanda

I'm working on a project in C# that involves parsing .pst files and my group has chosen to use the Redemption library to do so. We have successfully parsed the email files in to RDOMail objects, however now we want to write a subset of those emails to a new .pst file. I have successfully written the subset to .eml files using the email.SaveAs() function, but I'm at a loss to figure out how to save that list as a .pst. I've been sifting through the documentation, however it leaves much to be desired. Can anyone who has used Redemption point me in the right direction or provide an example?? Thanks in advance for your help!

È stato utile?

Soluzione

You will need to create/open a PST file using RDOSession.Stores.AddPstStore (returns RDOPSTStore object). Once you have the store, you can open/create folders (starting with the RDOStore.IPMRootFolder), create messages (RDOFolder.Items.Add) and copy old messages into new messages (RDOMail.CopyTo(RDOMail/RDOFolder)).

Altri suggerimenti

I have been struggling to do this for the last few hours and would like to save that time to others

You have to install redemption and add it as a reference to your project for it to work

            RDOSession session = new RDOSession(); // throws exception 1

        session.LogonPstStore(@"c:\temp\output.pst");
        RDOFolder folder = session.GetDefaultFolder(rdoDefaultFolders.olFolderInbox);

        string[] fileEntries = Directory.GetFiles(@"C:\emlFiles\", "*.eml");


        foreach (string filePath in fileEntries)
        {
            RDOMail mail = folder.Items.Add("IPM.Mail");
            mail.Sent = true;
            mail.Import(filePath, 1024);
            // folder.Items.Add(mail);
            mail.Save();
        }

        session.Logoff();

I also created a small sample windows forms app for it, I know the code is ugly but it does the trick

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top