Help with transport agent - save attachment RRS feed

  • Question

  • hi there

    i am migrating Exchange 2007 to 2010 at the moment. we use an OnSave eventsink that is attached to a public folder to save all incoming attachments to disk. 

    I need to re-create this in 2010, and as far as i can see, EventSink has been discontinued. 

    I have been looking at transport agents - but i have no programming background, and i can't see any way to apply a transport agent to a specific mailbox? 

    So i suppose my question is twofold:

    1) could someone help me write a transport agent for saving an attachement to file

    2) if i then have this transport agent, can it be applied to a specific mailbox / PF ?



    • Edited by Selspiero99 Thursday, April 11, 2013 9:37 AM
    Thursday, April 11, 2013 9:37 AM


All replies

  • Transport Agents allow you to process messages when that are in the Transport Pipeline (every messages sent/received in Exchange even sent between local mailboxes must traverse the Transport Pipeline). Because the agents work within that context they will fire on each and every message that goes through Exchange. If you only want them to apply to messages sent to particular mailboxes you just look at the envelope recipients of the message and if you find a match process the message further(have a look at the some of the Catchall Transport agents people have written which is good simple examples of using envelope recipients eg

    The other alternative if its just one mailbox is to use EWS Streaming notifications see


    Friday, April 12, 2013 7:21 AM
  • thanks Glen.

    I think EWS is the way to go with this, really does just need to be a simple script to save an attachment. 

    Aplogies for my ignorance, but with EventSink - the .vbs script was just attached to the mailbox. with EWS, i'm guessing it is completely different? where would the script live? would it be a scheduled task? or a standalone application?



    Friday, April 12, 2013 12:50 PM
  • If its just one mailbox, you don't need real time processing then i would suggest you write an EWS Managed API Powershell script (or application in something like C#) and then run it from a Schedule task. eg


    • Marked as answer by Selspiero99 Friday, April 19, 2013 11:15 AM
    Monday, April 15, 2013 6:45 AM
  • this is exactly what i need - thank you. 

    i have tried running this script, and editing it as the API is now version 2.0 - but i get an error:

    You cannot call a method on a null-valued expression.
    At C:\Users\ian\Desktop\dnlattach.ps1:36 char:1
    + $service.AutodiscoverUrl($aceuser.mail.ToString())

    i've probably missed something here. it also errors saying it throws an exception calling 'Bind'

    EDIT: i've fixed it - this works. 

    thanks so much.

    • Edited by Selspiero99 Friday, April 19, 2013 11:16 AM
    Friday, April 19, 2013 10:38 AM