locked
mail item move example RRS feed

  • Question

  • microsoft gives an example to move mails to another folder

    ... works perfect, but what about an inbox that has say 1000 mails, isn't this going to be to slow ?

    https://msdn.microsoft.com/en-us/library/office/ff860683.aspx

    Friday, May 13, 2016 6:18 AM

Answers

  • Hello,

    The Outlook object model doesn't provide any method or property for moving a batch of items simultaneously. However, you can use a low-level API on which Outlook is based on - Extended MAPI where you can run secondary threads for long-running operations. Following that way you will avoid any UI freezes and let users work in a usual manner. See MAPI Multithreading Rules for more information about that. Note, you can use any third-party wrappers around Extended MAPI such as Redemption, for example. 


    [custom.development]

    • Marked as answer by tekoko10 Friday, May 13, 2016 10:26 AM
    Friday, May 13, 2016 8:53 AM

All replies

  • Hello,

    The Outlook object model doesn't provide any method or property for moving a batch of items simultaneously. However, you can use a low-level API on which Outlook is based on - Extended MAPI where you can run secondary threads for long-running operations. Following that way you will avoid any UI freezes and let users work in a usual manner. See MAPI Multithreading Rules for more information about that. Note, you can use any third-party wrappers around Extended MAPI such as Redemption, for example. 


    [custom.development]

    • Marked as answer by tekoko10 Friday, May 13, 2016 10:26 AM
    Friday, May 13, 2016 8:53 AM
  • looks very interesting, but i'm afraid that i'm not experienced enough

    i thought i could somehow directly address the mails in outlook , but that is not possible , is it ?

    Friday, May 13, 2016 10:28 AM
  • On the Extended MAPI level, copying or moving messages is always done is batches (IMAPIFolder.CopyMessages(..., MESSAGE_MOVE)) - the method takes an array of entry ids. MailItem.Move simply uses a batch of 1 item.

    The only workarounds are either Extended MAPI (C++ or Delphi) and the IMAPIFolder.CopyMessages method or a library like Redemption (any language) - it exposes RDOItems.MoveMultiple method that takes an array of entry ids.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Friday, May 13, 2016 4:07 PM
  • Ok , i see, it really looks very interesting, But i need a solution in a few days and this i have to study But Many thanks for the effort to answer !
    Friday, May 13, 2016 6:06 PM