English 中文(简体)
VSTO - Outlook 2007 - Display form before send message?
原标题:

I m new to Outlook add-in programming and not sure if this is possible:

I want to display a pop-up form (or selection) and ask for user input at the time they click Send. Basically, whenever they send out an email (New or Reply), they will be asked to select a value in a dropdown box (list items from a SQL database, preferrably). Base on their selection, a text message will be appended to the mail s subject.

I did my research and it looks like I should use Form Regions but I m not sure how can I display a popup/extra form when user click Send. Also, it looks like Form Regions can be used to extend/replace current VIEW mail form but can I use it for CREATE NEW form?

Thanks for everybody s time.

最佳回答

You can probably add the Item Send event handler in the ThisAddIn Internal Startup method and then in the Item Send Event, call the custom form (a windows form). In the below sample I call a custom windows form as modal dialog before the email item is send and after the send button is clicked.

private void InternalStartup()
{
    this.Application.ItemSend += new ApplicationEvents_11_ItemSendEventHandler(Application_ItemSend);
}

void Application_ItemSend(object Item, ref bool Cancel)
{
    if (Item is Microsoft.Office.Interop.Outlook.MailItem)
    {
        Microsoft.Office.Interop.Outlook.MailItem currentItem = Item as Microsoft.Office.Interop.Outlook.MailItem; 
        Cancel = true;
        Forms frmProject = new ProjectForm();;

        DialogResult dlgResult = frmProject.ShowDialog();

        if (dlgResult == DialogResult.OK) 
            System.Windows.Forms.SendKeys.Send("%S"); //If dialog result is OK, save and send the email item
        else
            Cancel = false; 

        currentItem.Save();
        currentItem = null;
    }
}
问题回答

暂无回答




相关问题
Building a Com addin for Office 2000 / Office 2007

I am struggling to find a straight forward guide to creating office addins using VSTO and VB.net. Specifically I would like to know how to be able to create a addin/ dll which can either be ...

VSTO 3.0 Excel 2007 Addin Tab doesn t display

This is a very odd problem I ve found. I have written and successsfully deployed a VSTO 3.0 Addin for Excel 2007. The problem is that the Tab for the Ribbon only shows up on NEW instances of Excel; ...

VSTO - Outlook 2007 - Display form before send message?

I m new to Outlook add-in programming and not sure if this is possible: I want to display a pop-up form (or selection) and ask for user input at the time they click Send. Basically, whenever they ...

deleting named ranges in VSTO

I have a VSTO spreadsheet, and have re-jigged the front end. I need to change some named ranges to reflect this. Couldn t see a good way of doing this, so I created other named ranges and pointed ...

VSTO remove file without resigning the manifest

I have a file added to my vsto project and I want to remove this file after publishing the project. This is because the file should only be avaliable for some customers, for others we want to remove ...

Is there a future for PowerPoint VBA/VSTO? [closed]

Does anyone know what the future holds for VBA/VSTO programming in PowerPoint? I ve been working on a Office automation project and find it frustrating to work with PowerPoint in particular since it ...

热门标签