【问题标题】:How to develop a outlook add-in?如何开发outlook插件?
【发布时间】:2017-11-21 13:19:04
【问题描述】:

我希望创建一个适用于 Outlook 2010 和 Office 365 的 Outlook 加载项。

我想要它做的是将 MSG 格式的电子邮件保存到我们网络上我指定的文件夹中,然后将该电子邮件移动到 Outlook 中的存档文件夹。

我对编程知之甚少(只是基础知识)。我希望有人可以为我指明如何开始这个项目以及我可以使用哪些资源来做这件事的正确方向。

非常感谢任何帮助。

谢谢

【问题讨论】:

    标签: email outlook office365 outlook-addin outlook-2010


    【解决方案1】:

    请参阅Walkthrough: Creating Your First VSTO Add-In for Outlook 了解入门。

    我想要它做的是将 MSG 格式的电子邮件保存到我们网络上我指定的文件夹中,然后将该电子邮件移动到 Outlook 中的存档文件夹。

    要将电子邮件保存到文件夹,您需要使用 MailItem 类的 SaveAs 方法,该方法将 Microsoft Outlook 项目保存到指定路径和指定文件类型的格式。如果未指定文件类型,则使用 MSG 格式 (.msg)。例如:

    Sub SaveAsTXT() 
     Dim myItem As Outlook.Inspector 
     Dim objItem As Object 
    
     Set myItem = Application.ActiveInspector 
     If Not TypeName(myItem) = "Nothing" Then 
       Set objItem = myItem.CurrentItem 
       strname = objItem.Subject 
       'Prompt the user for confirmation 
       Dim strPrompt As String 
       strPrompt = "Are you sure you want to save the item? " &; _ 
       "If a file with the same name already exists, " &; _ 
       "it will be overwritten with this copy of the file." 
       If MsgBox(strPrompt, vbYesNo + vbQuestion) = vbYes Then 
         objItem.SaveAs Environ("HOMEPATH") &; "\My Documents\" &; strname &; ".txt", olTXT 
       End If 
     Else 
       MsgBox "There is no current active inspector." 
     End If 
    End Sub
    

    要将 Outlook 项目移动到另一个文件夹,您需要使用 Move 方法将 Microsoft Outlook 项目移动到新文件夹。

    最后,您可能会发现 Selecting an API or technology for developing solutions for Outlook 文章很有帮助。它解释了扩展 Outlook 的可能选项。

    【讨论】:

      【解决方案2】:

      使用 VSTO 创建 COM 插件。从https://msdn.microsoft.com/en-us/library/ms268878.aspx开始

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-05-19
        • 2015-08-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多