none
Export| Import emails & other items to another exchange server 2013 RRS feed

  • Question

  • Hi,

    We want to copy a mailbox from one exchange 2007|2010 server to another exchange 2013 server using EWS API, and found that we can use Export | Import EWS function.

    We have looked into this article by Glen Scales Exporting and Uploading Mailbox Items using Exchange Web Services using the new ExportItems and UploadItems operations and have few questions:

    1. As this operation was introduced in Exchange 2010 SP1, does it mean that we cannot use it on Exchange 2007 (all versions)?

    2. Is there any code sample which shows how to export to a Stream in memory, and then import that steam(to target server), so that we can skip the step which writes the data to File Transfer Stream format on disk. Glen's article also mentions a limitation that says that email items saved in FTS format can only be imported to an Exchange server with same version (SP\rollup), which is quite a hurdle for what we want to accomplish.

    3. Export | Import operations are not implemented in EWS Managed API, so is this possible that we get an Email Item using EWS Managed APi (using source server ExchangeService object), and then create a new EmailMessage item using the data of retrieved email item in last step (using target server ExchangeService object) and save on target server. Is it possible to copy an email item this way using Full fidelity and with Email message, Extended properties and attachments?

    Thanks in anticipation.


    Regards, David Johnson


    Sunday, January 25, 2015 3:49 PM

All replies

  • Is there anyone who can reply about this thread?

    Thanks.


    Regards, David Johnson

    Tuesday, January 27, 2015 3:35 PM
  • Hi David,

    1.) You are correct: You need Exchange 2010 SP1 for that. It might be enough to add an Exchange 2010 CAS to add that functionality though.

    2.) Should be doable, however I can't really spend the effort right now to write it up myself, sorry.

    3.) Doing the export / Import manually would be a lot of effort, however it should be doable with full fidelity. I would advice against doing so, both due to implementation effort and performance lack.

    Cheers,
    Fred


    There's no place like 127.0.0.1

    Wednesday, January 28, 2015 9:28 AM
  • Hi,

    Fred@ thank you for the reply.

    1. Ok. We also have an exchange 2007 sp3, so would like to test this to make it sure.

    2. If this is possible, hopefully we would find out how it is done.

    3. Actually as 'EWS API Export and Import' may not seem possible for Exchange 2007, so we might use this approach:

    a. we get an Email Item using EWS Managed APi (using source server ExchangeService object).

    b. create a new EmailMessage item using the data of retrieved email item in  step a (using target server ExchangeService object).

    c. save newly created item on target server.

    We have to check how much fidelity we can maintain using this approach. We are not still sure how to cop attachments this way?

    Thanks.


    Regards, David Johnson

    Wednesday, January 28, 2015 8:18 PM
  • Hey Cyber Friend,

    Did you every figure out how to do #2 (export/import in memory)? I have started messing with something similar and was making the assumption that i would be able to pass the raw "data" portion of the soap response to the "data" portion of the uploaditems request. 

    Glen Scales is usually all over this forum, so i'm hoping my update will pop it into his view (fingers crossed).


    DJ Grijalva | MCITP: EMA 2007/2010 SPA 2010 | www.persistentcerebro.com

    Thursday, March 26, 2015 9:33 PM
  • The data stream is just an opaque Base64 String so you can just read and write it as a memory stream. Email can get large eg 50 MB so that can consume large chunks of memory if your not careful. That said I would always use MAPI over EWS if you going to copy data between different orgs as you will have a lot more flexibility around versions and changing content.

    Cheers
    Glen

    Friday, March 27, 2015 3:28 AM
  • Hi,

    @DJ Grijalva : No, we didnt find any web article or forum post explaining it.

    @Glen: Can you please explain this:

    The data stream is just an opaque Base64 String so you can just read and write it as a memory stream.

    We need to copy mailbox contents from an Exchange 2007 mailbox to an Exchange 2013 mailbox using EWS API. 

    Thanks.


    Regards, David Johnson

    Sunday, May 10, 2015 12:23 AM
  • >>We need to copy mailbox contents from an Exchange 2007 mailbox to an Exchange 2013 mailbox using EWS API.

    If you have 2007 then forget about using UploadItems the only method that is going to work is either using CreateItem and either using the MIME Stream for message and don't worry about the fidelity loss (eg this is going to be the same as doing a IMAP migration). Or try to reconstitute the Message Property by Property using CreateItem (a pretty big task). My advice is use MAPI to export the messages to a PST (or just MSG files) and then copy them into the source Server. This is going to faster, easier and give full fidelity.( Just look at Microsoft's PST Import service just released for o365 https://technet.microsoft.com/en-us/library/dn948519%28v=exchg.150%29.aspx they are just automating new-mailboximportrequest on Exchange 2013 for good reason).

    Cheers
    Glen

    Monday, May 11, 2015 3:08 AM
  • Hi

    Glen, thanks for responding to my query again. I really appreciate that, and honestly your comments are really very much informative for EWS developers.

    Here is my reply to your last post:

    @If you have 2007 then forget about using UploadItems

    Yes, you are right, as this method was introduced in Ex 2010 SP1, so its obvious this is not supported.

    @ the only method that is going to work is either using CreateItem and either using the MIME Stream for message and don't worry about the fidelity loss (eg this is going to be the same as doing a IMAP migration). Or try to reconstitute the Message Property by Property using CreateItem (a pretty big task).

    I  have made many tests to copy emails and appointments from Exchange 2007 to Exchange 2010\2013, by creating a new EmailMessage\Appointment object on target server, and copying all settable fields and MIME contents, and tests are very encouraging. Emails are copied with all data including attachment. Would you suggest to test\investigate any potential problem if we use this method?

    One problem I saw is, when we create a new meeting object (Appointment) with attendees, then meeting invitation is sent to all attendees. I hope there is some way to cope with this.

    @ My advice is use MAPI to export the messages to a PST (or just MSG files) and then copy them into the target Server. This is going to faster, easier and give full fidelity.

    I think this MAPI export to MSG file is little complex method, as I would have to use Redemption or Outlook MAPI. I would still like to investigate this method too. Can you refer any web link, which demonstrate conversion of a Mapi Item to .msg or .eml file?

    Is it possible to uplod an email (which is in MSG file) to exchange 2013 mailbox usign EWS API? I know I can import an .eml file, but not sure about .msg.

    Also, what about exporting Appointments, Contacts, and Tasks. Would i have to export Appointment to iCal (.ics) , Contact to vCard (.vcf)?

    Pardon me, so many questions. I would really appreciate your reply on this.

    Thanks in anticipation.


    Regards, David Johnson

    Tuesday, May 12, 2015 9:21 PM
  • >> One problem I saw is, when we create a new meeting object (Appointment) with attendees, then meeting invitation is sent to all attendees. I hope there is some way to cope with this.

    Make sure you always set https://msdn.microsoft.com/en-us/library/exchangewebservices.createitemtype.sendmeetinginvitations%28v=exchg.140%29.aspx to None>>I think this MAPI export to MSG file is little complex method, as I would have to use Redemption or Outlook MAPI. I would still like to investigate this method too. Can you refer any web link, which demonstrate conversion of a Mapi Item to .msg or .eml file?

    Redemption has a SaveAs Method http://www.dimastr.com/redemption/RDOMail.htm just use rdoSaveAsType 9 and you have a Unicode MSG or copy all the messages to a PST and then use new-mailboximportrequest to import them on 2013.

    >> Is it possible to uplod an email (which is in MSG file) to exchange 2013 mailbox usign EWS API? I know I can import an .eml file, but not sure about .msg.

    No you need to use MAPI to do this so if your using Remdemption you create a profile and import them in or a better idea is as I mentioned use new-mailboximportrequest (new-mailboximportrequest is built and optimized to do bulk imports eg the process is handled by the Mailbox Replication Services, using the Client API's whether its EWS or MAPI via Redemption means your going to be throttled if you doing bulk migrations the difference in performance and time to import could be very substantial using a Client API to do Migrations should be a last resort mechanism).

    Cheers
    Glen

    Wednesday, May 13, 2015 4:34 AM
  • Hi

    I am new to EWS, but I have worked on MAPI extensively.

    MAPI Approach:

    When we make use of MAPI, we would need to create a mail profile(manually or programatically)

    Though we could program "moving of emails from one mailbox to other mailbox", it seems like a "complicated solution" for the larger installations where there are thousands of mailboxes, for which programmer would have to create a "mail profile" for every mailbox.  Also programmer would need make sure that every email property is queried, and moved to the destination mailbox.

    MAPI also has its own limitations. e.g. MAPI Is Not Suitable for HTML Messages

    EWS Approach:

    This looks like a easier approach.

    In case, you want to move all mails from a inbox folder, you could make use of the following logic

    1) Export all email items from Exchange 2007 to a file system folder in eml format

    2) Import all eml files into Exchange 2013

    Similar thing needs to be done for all folders(e.g. Outbox, Sent items etc) and items(like contacts, appointments, notes and tasks)

    Regards,

    Rohan


    Tuesday, May 19, 2015 4:23 AM