locked
[E2007][E2010][EWS][C#] Moving mail between mailboxes from addin - good approach? RRS feed

  • Question

  • Hello,

    I'm developing an Outlook addin and was told to perhaps ask in this forum about this matter.

    Basically one part of this addin has functionality to Move selected/open mail in outlook to another (shared) mailbox using EWS.

    This works fine on the EWS part but I had some challenges retrieving the data which EWS requires.

    Basically what I do is

    a. retrieve the e-mail address of the store in which the e-mail is in. This is done accessing an Exchange-DN value from ENTRY_STORE_ID

    b. Get the ID of the email and convert this to EWS-ID and then Bind to an emailmessage object with that ID provided.

    c. find and bind the destination mailbox and folder

    d. move the email

    The part which i feel seems fragile is the retrieval of the e-mail address given a store. The Exchange-DN Seems to be a legacy value. But since the ID-conversion requires a mailbox-name I'm somewhat stuck with this approach.

    Is there perhaps a better way to achieve what I want ?

    Wednesday, February 29, 2012 1:07 PM

All replies

  • If this is an Outlook Add-in why are you using EWS ? the best API to use within an Outlook Add-in in the OOM given then outline of what you want to do that is all achievable with the OOM.

    If your working within Outlook you can get the display name of the current store via the OOM http://msdn.microsoft.com/en-us/library/bb207416.aspx and resolve that instead which would be more accurate.

    Cheers
    Glen

    Thursday, March 1, 2012 1:38 AM
  • Hi Glen,

    thanks for replying,

    the reason I used EWS was because OOM doesn't seem to have any concept for moving items to accounts/mailboxes which aren't added to outlook. And though I might be able to add shared mailboxes programatically with OOM in order to get access to those mailboxes it isn't something which is desirable for users.

    Thursday, March 1, 2012 12:33 PM