IImportExport interface

 

IImportExport interface is exposed by the RDOMail object and objects derived from it, such as RDOContactItem, RDOAppointmentItem, etc.

 

//the example below uses a sample FileIStream class that implements the IStream COM interface

//Download FileIStream implementation.

//The code below is the same as

//  msg = session.CreateMessageFromMsgFile(@"c:\temp\647_ImportExport\new.msg");

//   msg.Import(@"c:\temp\647_ImportExport\sample.fts", rdoSaveAsType.olFTS);

//  msg.Save();

//Create a new MSG file

using (FileIStream msgFileStream = new FileIStream(@"c:\temp\647_ImportExport\new.msg", true, true)) //new file, r/w access

{

    msg = session.CreateMessageFromIStream(msgFileStream as IStream);

    //the code below is the same as msg.Import(@"c:\temp\647_ImportExport\sample.fts", rdoSaveAsType.olFTS);

    IImportExport importExport = msg as IImportExport;

    //open existing file with read-only access. You can create a memory based (or any other) stream instead

    using (FileIStream fileStream = new FileIStream(@"c:\temp\647_ImportExport\sample.fts", false, false))

    {

        importExport.Import(fileStream as IStream, rdoSaveAsType.olFTS);

    }

    msg.Save();

    ((IDisposable)msg).Dispose();

    msg = null;/p>

}

 

 


Derived from: IUnknown

 

Methods


Import(Stream, Type)

Imports the contents of an IStream COM object into the message.

 

Stream - IStream COM object.

 

Type - One of the rdoSaveAs enum values.

 


SaveAs(Stream, Type)

Saves the message to the IStream COM object in the specified format.

 

Stream - IStream COM object.

 

Type - One of the rdoSaveAs enum values.