locked
how to delete a mail from drafts folder using VSTO RRS feed

  • Question

  • Hi,

    Please suggest, I need urgent help on this one.

    I have developed a plugin for outlook using VSTO 4.0. The plugin has a button for the "New,Forward,Reply and Reply To All" type of mails. basically I wish to use this one instead of the default SEND button. The button uses the API to send the mail to certain recipients and also do some other processing.

    For resolving recipients, I need to save the mail once...(its a wierd thing, but I MUST do this step in my code for resolving recipients). When the recipients are not resolved, checknames and SelectNamesDialog show up(I bring those up). All that is great.

    Finally if the user still doesnt resolve the names, and tries to close the mail without sending, the Save prompt comes up.(I dont bring this one up). I expect the mail to get deleted from the drafts if the user choses NO on the save prompt. Surprisingly this doesnt happen.

    So now what I need to do is:

    1. either replace the save prompt with a custom message box and delete the mail myself, OR
    2. somehow get to know what the user clicked on the Save prompt so that I may go and delete the mail(again myself, as Outlook doesnt do it for me), OR
    3.Flag the mail as saved so that the Save prompt doesnt come again(Not sure if this would happen though) when user closes the mail, so that I can just bring up my custom prompt and delete the mail if user chooses NO on my prompt messagebox.

    I am not sure which one of these is viable/feasible.
    I tried option 1, but my prompt is again followed by the Outlook Save prompt...I dont want that to come because I am handling that stuff by myself now in code.
    Regarding option 3, I came across a 'Saved' properly but unfortunately its readonly...so I guess option 3 is ruled out.

    Please help...ask for more info if what I aim for is not clear.

    Wednesday, November 24, 2010 6:03 AM

Answers

  • When you save the item using code that sets the Saved property to true. There is no way to know what the user selected as far as saving or not from that dialog. The best you can do is keep tabs on Saved, and handle the Write() event which is fired when an item is saved. You can coordinate that setting, your actions as far as saving the item and the Write() event, seeing if you triggered Write() by calling Save() or if it was triggered by the user.

    --
    Ken Slovak
    [MVP - Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007.
    Reminder Manager, Extended Reminders, Attachment Options.
    http://www.slovaktech.com/products.htm
     
     
    "Abhishek.Tiwari" <=?utf-8?B?QWJoaXNoZWsuVGl3YXJp?=> wrote in message news:09ad2868-d5cc-4453-81cc-f9d8643c19f7...

    Hi,

    Please suggest, I need urgent help on this one.

    I have developed a plugin for outlook using VSTO 4.0. The plugin has a button for the "New,Forward,Reply and Reply To All" type of mails. basically I wish to use this one instead of the default SEND button. The button uses the API to send the mail to certain recipients and also do some other processing.

    For resolving recipients, I need to save the mail once...(its a wierd thing, but I MUST do this step in my code for resolving recipients). When the recipients are not resolved, checknames and SelectNamesDialog show up(I bring those up). All that is great.

    Finally if the user still doesnt resolve the names, and tries to close the mail without sending, the Save prompt comes up.(I dont bring this one up). I expect the mail to get deleted from the drafts if the user choses NO on the save prompt. Surprisingly this doesnt happen.

    So now what I need to do is:

    1. either replace the save prompt with a custom message box and delete the mail myself, OR
    2. somehow get to know what the user clicked on the Save prompt so that I may go and delete the mail(again myself, as Outlook doesnt do it for me), OR
    3.Flag the mail as saved so that the Save prompt doesnt come again(Not sure if this would happen though) when user closes the mail, so that I can just bring up my custom prompt and delete the mail if user chooses NO on my prompt messagebox.

    I am not sure which one of these is viable/feasible.
    I tried option 1, but my prompt is again followed by the Outlook Save prompt...I dont want that to come because I am handling that stuff by myself now in code.
    Regarding option 3, I came across a 'Saved' properly but unfortunately its readonly...so I guess option 3 is ruled out.

    Please help...ask for more info if what I aim for is not clear.


    Ken Slovak MVP - Outlook
    • Proposed as answer by Amy Li Tuesday, November 30, 2010 7:08 AM
    • Marked as answer by Amy Li Wednesday, December 1, 2010 8:44 AM
    Wednesday, November 24, 2010 3:15 PM