无法在 VB .net 中读取 .msg 文件

问题描述 投票:0回答:1

我想使用 Visual Studio 2022 读取 .msg 文件 VB .Net。每当我尝试时,都会收到以下错误。我的示例代码:

Imports Microsoft.Office.Interop
Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim filePath As String = "C:\Email\Source\Tet.msg" 
        Dim outlookApp As New Outlook.Application()
        Dim mailItem As Outlook.MailItem = outlookApp.CreateItemFromTemplate(filePath)
        Dim subject As String = mailItem.Subject
        Dim body As String = mailItem.Body
    End Sub
End Class

错误如下:

System.IO.FileNotFoundException: 'Could not load file or assembly 'office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'. The system cannot find the file specified.'

vb.net outlook
1个回答
0
投票

引用的 Outlook 版本错误。

© www.soinside.com 2019 - 2024. All rights reserved.