Moving e-mail item on TransportAgent event RRS feed

  • Question

  • Hi,

    I want to move an e-mail item from one account to another in a TranportAgent event. Is that possible? How do I have to do this? Perhaps I can access EWS from within the event? I looked at the MoveItemType class and implemented the example from MSDN help but can't get it running.

    Or maybe there is another technology I can use for moving e-mails?

    I'm using Ooutlook 2010 on Exchange 2007 (Version 8.0.535.0).

    Please help!

    Thanks in advance!


    Thursday, February 17, 2011 1:29 PM

All replies

  • A TransportAgent (TA) is not the place to be moving mail items.  The problem is that when a TA gets a mail item, that item is in transit - it doesn't yet have a 'place'.  Without a place, how can you move the item?


    The MoveItem method you referred to is an Exchange Web Services (EWS) method.  It can move items, but those items have already been delivered to a mailbox, so they have a 'place' to move from.  As I said, items flowing through a Hub Transport are in-transit, and do not yet have a 'place'.


    As for accessing EWS from within the event, you absolutely can instantiate EWS from within a TA, but you will have an enormously BAD impact on mail flow!  A TA must return from processing a mail item before Exchange will continue processing that item, and EWS is not the fastest beast on the block.  




    Thursday, February 17, 2011 4:05 PM
  • Thank you very much for your explanation! That is what I was already guessing.

    But where do I have to hook in to intercept mail events such as OnSending. Another way I think of is to write vba code for Outlook. But this is not the savest thing. If any error occurs on the client the server does not get involved (i.e. for workflow purposes)

    Isn't there any other way to implement server side event-based mail moving?

    Thursday, February 17, 2011 8:57 PM
  • Why don't you tell me exactly what it is you're trying to do, and maybe I can point you in the right direction.




    Thursday, February 17, 2011 11:07 PM
  • I have to implement a solution that allows sending on behalf of another user and then moves sent mails into the "sent items" folder of the other user. This seems to be a simple demand but I spent a lot of time on solving this. With no success.

    I'm using Exchange 2007 and Outlook 2010.

    I tried two approaches.

    1. Giving the permissions on Exchange
      Granting FullAcces with Add-MailboxPermission and then removing the right to delete with Add-MailboxPermission ... -AccessRights DeleteItem -deny. Then opening the postbox as an additional postbox. Sent Items were moved into the correct sent items folder. But the user can still delete items in the connected postbox.
      This does not work because the DeleteItem permission with the -deny flag does not take precedence over the FullAccess permission
    2. Giving Permissions in Outlook
      Granted AccessRights as mentioned in this article. But then I have the problem that sent items are not moved to the sent items folder of the connected postbox. For this approach I need a mechanism to move items with some kind of code or something.

    I would be very grateful if you have any solution...


    Friday, February 18, 2011 7:25 AM
  • I would probably use your second approach, and also implement a Push Subscription to do the work of moving or copying (whichever you prefer) the item from the SentItems folder of the user who sent the item to the user on whose behalf the item was sent.  The EWS Managed API can do this for you.

    Here is a link to a wrapper that can help you immensely with getting a Push Subscription going, especially with the http listener that you'll need to have running inside your code.



    Monday, February 21, 2011 3:53 PM
  • Thank you for your reply. I will have a look at your link the next days. At the moment I'm involved in some other problems. I will give you feedback if I get it running.

    Thanks again and have a nice day


    Tuesday, February 22, 2011 11:08 AM