Outlook“另存为 html”在邮件消息工具栏上

发布于 2024-10-21 07:50:10 字数 385 浏览 5 评论 0原文

我工作的医疗公司有一个 EMR 系统,可以保存患者文件的数字副本,以便可以搜索和快速访问。出现了一个新请求,希望能够将电子邮件保存到 EMR 系统,但它不能很好地显示 .msg 文件。它确实可以很好地显示 .htm 文件,因此希望我能找到一种方法,将电子邮件以 .htm 格式保存到特定文件夹,用户只需单击一个按钮即可。

我应该考虑使用 vs 2010 制作一个插件来完成这个简单的任务吗?或者有更好的方法来做到这一点吗?

在过去的几天里,我已经探索过使用命令栏简短地制作一个加载项,但在将菜单项添加到邮件项目时遇到了许多问题,以及丢失事件处理程序或让它们多次触发,所以我'我想知道我是不是找错了树。

编辑:看看功能区栏自定义,可能需要升级一些仍在使用 2003 的用户,但看起来它可能是比命令栏更好的选择。

The medical company I work for has a EMR system setup to keep digital copies of patient files so they are searchable as well as quick to access. A new request has come through to be able to save e-mail to the EMR system, however it does not display .msg files very nicely. It does display files nicely as .htm, so was hoping i could figure out a way to save email messages to a specific folder in a .htm format with the user just hitting a single button.

Should i be looking at making an add-in using vs 2010 to do this simple task? Or would there be a better way to do this?

I've explored making an Add-In breifly over the past few days using command bars but have hit numerous problems with adding the menu item to mail items, as well as losing event handlers or having them fire quite a few times, so i'm wondering if i'm barking up the wrong tree.

Edit: Looking at ribbon bar customization as well, may have to upgrade some users that are still using 2003, but seems like it might be the better option than command bars going forward.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

向日葵 2024-10-28 07:50:10

功能区栏是我发现的最佳路径,但是我很难找到从头到尾项目的良好操作方法,因此我将在这里写一篇小文章。

向功能区添加一个按钮,仅用于现有邮件消息,包括该按钮的图像。

使用 VS 2010
新建Office项目,选择“Outlook 2007加载项”,输入项目名称。
在您新创建的项目中,添加一个新项目“Ribbon (XML)”,将其命名为您想要的名称,我将其称为 CustomRibbon
打开新创建的 CustomRibbon.xml 文件并将选项卡节点更改为具有以下内容。

  <tab idMso="TabReadMessage">

    <group insertBeforeMso="GroupActions" id="CustomGroup" label="GroupNameThatShowsInOutlook">
      <button id="btnCustomButton"
            label = "Text For The Custom Button"
            supertip="tip for the button hover"
            onAction ="ButtonClicked"
            size="large"
            getImage="GetCustomButtonImage" />

    </group>
  </tab>

然后,CustomRibbon.cs 文件有 2 个回调函数,一个称为 GetCustomButtonImage,另一个称为 ButtonClicked。

打开 CustomRibbon.cs 来填写此内容,在功能区回调区域中添加以下内容,

public void ButtonClicked(Office.IRibbonControl Control)
{
   //Do work here
}

并在同一部分中添加以下内容

public stdole.IPictureDisp GetCustomButtonImage(Office.IRibbonControl control)
{
   System.Drawing.Image myImage;
   myImage = OutlookAddIn.Properties.Resources.ImageName;
   return AxHostConverter.ImageToPictureDisp(myImage);
}

,然后这将显示缺少一个类,我们很快就会介绍这一点,但首先我们要添加最后一部分我们需要在 CustomRibbon.cs 中。在 IRibbonExtensibility Members 区域中,在 GetCustomUI 中更改现有代码

public string GetCustomUI(string ribbonID)
{
   if (ribbonID == "Microsoft.Outlook.Mail.Read")
   {
      return GetResourceText("OutlookAddIn.CustomRibbon.xml");
   }
   else
   {
      return "";
   }
}

将其添加到顶部

将一个新类添加到您的项目中,将其命名为 AxHostConverter,使用 System.Windows.Forms ;
使用系统绘图;

然后更改类以包含以下代码

class AxHostConverter : AxHost
{
    private AxHostConverter() : base("") { }

    static public stdole.IPictureDisp ImageToPictureDisp(Image image)
    {
        return (stdole.IPictureDisp)GetIPictureDispFromPicture(image);
    }

    static public Image PictureDispToImage(stdole.IPictureDisp pictureDisp)
    {
        return GetPictureFromIPicture(pictureDisp);
    }
}

将按钮的图像添加到项目中,并更改 GetCustomButtonImage 函数以使用该资源。我使用了 PNG,并且很幸运,透明胶片显示得很好。

最后,剩下的就是将以下内容添加到 ThisAddIn.cs

    protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
    {
        return new CustomRibbon();
    }

将您想要的任何代码添加到 ButtonClicked 中,然后就完成了。

使用 Clickonce 进行部署,安装相当简单。

Ribbon bar was the best path i found, however i had trouble finding a great how-to for the start-to-finish project, so i'll make a small write up here.

To add a button to the ribbon for only existing mail messages including a image for the button.

Using VS 2010
New project, Office, select "Outlook 2007 add in", enter a name for your project.
To your newly created project, Add a new item "Ribbon (XML)" name it however you want, i'll call it CustomRibbon
open your newly created CustomRibbon.xml file and change the tab node to have the following

  <tab idMso="TabReadMessage">

    <group insertBeforeMso="GroupActions" id="CustomGroup" label="GroupNameThatShowsInOutlook">
      <button id="btnCustomButton"
            label = "Text For The Custom Button"
            supertip="tip for the button hover"
            onAction ="ButtonClicked"
            size="large"
            getImage="GetCustomButtonImage" />

    </group>
  </tab>

This then has 2 callback functions to the CustomRibbon.cs file, one called GetCustomButtonImage, the other ButtonClicked.

open CustomRibbon.cs to fill this in, in the Ribbon Callbacks region add the following

public void ButtonClicked(Office.IRibbonControl Control)
{
   //Do work here
}

also add the following in the same section

public stdole.IPictureDisp GetCustomButtonImage(Office.IRibbonControl control)
{
   System.Drawing.Image myImage;
   myImage = OutlookAddIn.Properties.Resources.ImageName;
   return AxHostConverter.ImageToPictureDisp(myImage);
}

this will then show there is a class missing, we'll get to that shortly, but first we are going to add in the last part we need in CustomRibbon.cs. In the IRibbonExtensibility Members region, in GetCustomUI change the existing code

public string GetCustomUI(string ribbonID)
{
   if (ribbonID == "Microsoft.Outlook.Mail.Read")
   {
      return GetResourceText("OutlookAddIn.CustomRibbon.xml");
   }
   else
   {
      return "";
   }
}

Add a new class to your project call it AxHostConverter, add add this to the top

using System.Windows.Forms;
using System.Drawing;

Then change the class to have the following code

class AxHostConverter : AxHost
{
    private AxHostConverter() : base("") { }

    static public stdole.IPictureDisp ImageToPictureDisp(Image image)
    {
        return (stdole.IPictureDisp)GetIPictureDispFromPicture(image);
    }

    static public Image PictureDispToImage(stdole.IPictureDisp pictureDisp)
    {
        return GetPictureFromIPicture(pictureDisp);
    }
}

Add your image for your button to the project, and change the GetCustomButtonImage function to use that resource. I used a PNG and had good luck with transparencies displaying well.

And finally, all that should be left is to add the following to ThisAddIn.cs

    protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
    {
        return new CustomRibbon();
    }

Add whatever code you are wanting to ButtonClicked and you are set.

Deploy using Clickonce and installation is fairly straightforward.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文