none
Deleting mail messages from exchange server from an outlook add-in RRS feed

  • Question

  • I am writing a add-in for outlook 2010 (windows desktop version) using Visual studio tools for office.
    The outlook client has a exchange email configured.
    I want to allow the user to delete messages from the exchange server.
    I think it should be do-able if I use the exchange web services or use some third party library but in order to do this I would have to ask the user to re-specify his exchange email configuration to my add-in - I want to AVOID this.

    I am wondering if there is a easier way to do this by calling some outlook or VSTO API, basically I am looking for a way to tell outlook to delete these messages from the server from my add-in's code.
    I have tried searching the VSTO documentation but have gotten no results.

    Zodiac7

    Wednesday, March 1, 2017 12:44 PM

All replies

  • I am writing a add-in for outlook 2010 (windows desktop version) using Visual studio tools for office.
    The outlook client has a exchange email configured.
    I want to allow the user to delete messages from the exchange server.
    I think it should be do-able if I use the exchange web services or use some third party library but in order to do this I would have to ask the user to re-specify his exchange email configuration to my add-in - I want to AVOID this.

    I am wondering if there is a easier way to do this by calling some outlook or VSTO API, basically I am looking for a way to tell outlook to delete these messages from the server from my add-in's code.
    I have tried searching the VSTO documentation but have gotten no results.

    Zodiac7

    Wednesday, March 1, 2017 12:45 PM
  • Hello,

    The Outlook object model (nor VSTO) doesn't provide anything for that. You can use EWS, see EWS Managed API, EWS, and web services in Exchange for more information.


    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Wednesday, March 1, 2017 3:04 PM
  • Hello,

    VSTO (nor the Outlook object model ) doesn't provide anything for that. You can use EWS, see EWS Managed API, EWS, and web services in Exchange for more information.


    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Wednesday, March 1, 2017 3:04 PM
  • I am guessing that I will have to then ask my add-in's user to re-specify his details (credentials, etc.) for connecting to the exchange server, any way to avoid that?


    Zodiac7

    Wednesday, March 1, 2017 6:04 PM
  • What is wrong with MailItem.Delete? Are you concerned that it will be deleted from the local OST file and not immediately deleted from the remote Exchange mailbox? 

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

    Wednesday, March 1, 2017 6:18 PM