VSTO自定义文件夹类型自定义、文件夹、类型、VSTO

2023-09-06 14:05:49 作者:猥琐帝

是否有可能创建使用VSTO为Outlook 2007中的自定义文件夹类型? (即类似于olFolderContacts等一个新的文件夹类型)

Is it possible to create a custom folder type using VSTO for Outlook 2007? (i.e. a new folder type similar to olFolderContacts and so on)

理想的情况是我想要做的就是有,选中它,将在主Outlook窗口(这里的收件箱和preVIEW窗格中)创建一个新的窗体区域并显示一个WPF用户控件的文件夹。

Ideally what I would like to do is have a folder which, when selected, would create a new form region in the main Outlook window (where the Inbox and the Preview Pane are) and display a WPF User Control.

感谢

我发现,图像同时试图解决这个问题:的 HTTP://www.add-in-ex$p$pss.com/add-in-net/outlook-regions-basics.php

I found that image meanwhile trying to solve this question at: http://www.add-in-express.com/add-in-net/outlook-regions-basics.php

推荐答案

找到了解决办法。唯一需要注意的是,我需要购买高级展望区域的VSTO 它花了我100块钱。如果您购买的产品,这是你怎么做:

Found the solution. The only caveat is that I need to purchase Advanced Outlook regions for VSTO and it cost me 100 dollars. If you purchase that product this is how you do it:

1。在类型vistual Studio中创建一个新的项目(Outlook 2010的加载项),我叫我的项目 OutlookAddIn1

1. Create a new project on vistual studio of type (Outlook 2010 Add-in) I named my project OutlookAddIn1

2。添加一个新的项目,以项目(产品,我需要购买)

2. Add a new item to the project (Product that I needed to purchase)

3。当您选择项目向导显示了选择下列选项:

3. When you select that item a wizard shows up select the following options:

4。遵循所有默认设置,直到完成向导(单击下一步,下一步等完成)

5。有你有一个窗口的形式。为了将WPF内容,您将需要添加一个的ElementHost 控件。有关于如何承载Windows窗体上的一个WPF用户控件日志的教程。为了保持这个答案并不长,我不会展示如何。

5. There you have a windows forms. In order to place WPF content you will need to add a ElementHost controls. There are a log of tutorials on how to host a wpf usercontrol on windows forms. To keep this answer not that long I will not show how.

6。对于这个答案的演示中,我只是把该表格上的一个按钮:

6. For demo of this answer I will just place a button on that form:

7。与按钮的preSS我将隐藏的形式,并显示该文件夹的deffault观点。因此,这里是该按钮背后的code:

    private void button1_Click(object sender, EventArgs e)
    {
        // disable the form that id does not show up
        Globals.ThisAddIn.ADXOlForm1Item.Enabled = false;

        // get the current selected folder
        var thisFOlder = Globals.ThisAddIn.Application.ActiveExplorer().CurrentFolder;

        // remove the webview pane in order to show the main folder view instead
        thisFOlder.WebViewOn = false;
        thisFOlder.WebViewURL = string.Empty;

        // RESET FOLDER BY SELECTING A DIFFERENT ONE THEN THE SAME ONE
        NameSpace nameSpace = Globals.ThisAddIn.Application.GetNamespace("MAPI");
        MAPIFolder outboxFolder = nameSpace.GetDefaultFolder(OlDefaultFolders.olFolderOutbox);
        Globals.ThisAddIn.Application.ActiveExplorer().CurrentFolder = outboxFolder; // CHANGE FOLDER TO A DIFFERNT ONE
        System.Windows.Forms.Application.DoEvents();
        Globals.ThisAddIn.Application.ActiveExplorer().CurrentFolder = thisFOlder; // SET INBOX AGAIN

        // remeember to release objects
        Marshal.ReleaseComObject(nameSpace);
        Marshal.ReleaseComObject(outboxFolder);
        Marshal.ReleaseComObject(thisFOlder);

        this.Close();
    }

8。当我再运行,当我看到选择类型的邮件中的任何文件夹时,该项目注:

8. When I then run that project note when I see when selecting any folder of type Mail:

9。如果我preSS该按钮然后,我会展示我所选择的文件夹的默认视图

这是我现在唯一的万阿英,蒋达清是该视图显示类型的MailItem的每个文件夹。您可以选择在第一威泽德东西是不是常见的像Jurnal不同的文件夹类型。然后,在你身后的code可以选择jurnal文件夹的形式显示出来。

The only probelm that I have now is that the view shows for every folder of type MailItem. You could select a different folder type on the first wizzard something that is not that common like Jurnal. Then on code behind you can select a jurnal folder for that form to show up.

 
精彩推荐
图片推荐