我想在我的vb.net表单中显示我的Outlook收件箱,其中包含
等导航<<上一页下一页>>>
邮件正文必须包含Outlook模板,并显示所有有用的内容,如
如果有人有任何想法,请帮助我。
提前致谢。
答案 0 :(得分:0)
第一个结果谷歌给了我: (修改了一下) 基础在那里,你可以开始试验。 至少尝试自己创造一些东西,而不是重新发布以及你尝试过的代码。
导入System.Reflection 导入Microsoft.Office.Interop
Module Module1
Sub Main()
' Create Outlook application.
Dim oApp As Outlook.Application = New Outlook.Application()
' Get Mapi NameSpace.
Dim oNS As Outlook.NameSpace = oApp.GetNamespace("mapi")
oNS.Logon("YourValidProfile", Missing.Value, False, True) ' TODO:
' Get Messages collection of Inbox.
Dim oInbox As Outlook.MAPIFolder = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
Dim oItems As Outlook.Items = oInbox.Items
Console.WriteLine("Total : " & oItems.Count)
' Get unread e-mail messages.
oItems = oItems.Restrict("[Unread] = true")
Console.WriteLine("Total Unread : " & oItems.Count)
' Loop each unread message.
Dim oMsg As Outlook.MailItem
Dim i As Integer
For i = oItems.Count To 1 Step -1
oMsg = oItems.Item(i)
Console.WriteLine(i)
Console.WriteLine(oMsg.SenderName)
Console.WriteLine(oMsg.Subject)
Console.WriteLine(oMsg.ReceivedTime)
Console.WriteLine(oMsg.Body)
Console.WriteLine("---------------------------")
Console.ReadLine()
Next
' Log off.
oNS.Logoff()
' Clean up.
oApp = Nothing
oNS = Nothing
oItems = Nothing
oMsg = Nothing
End Sub
End Module
以表格形式显示:
Imports Microsoft.Office.Interop
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim oApp As New Outlook.Application
Dim mitem As Outlook.MailItem
mitem = oApp.CreateItemFromTemplate("\\Files\HC_METOD\SVA\meeting.msg")
WebBrowser1.DocumentText = mitem.HTMLBody
End Sub
End Class