MailItem 对象 (Outlook)

代表一封邮件。

备注

使用 CreateItem 方法创建表示新邮件的 MailItem 对象。

使用 Folder.Items 属性获取一个 Items 集合,该集合代表文件夹中的邮件项目, Items.Item (索引) 方法,其中 index 是邮件邮件的索引号或用于匹配邮件的默认属性的值,以便从指定文件夹返回单个 MailItem 对象。

示例

下面的 Visual Basic for Applications (VBA) 示例创建并显示一封新邮件。

Sub CreateMail() 
 
 Dim myItem As Object 
 
 
 
 Set myItem = Application.CreateItem(olMailItem) 
 
 myItem.Subject = "Mail to myself" 
 
 myItem.Display 
 
End Sub

下面的 VBA 示例将当前文件夹设置为收件箱并显示文件夹中的第二封邮件。 一般情况下,文件夹中的邮件顺序不保证按特定顺序。

Sub DisplayMail() 
 
 Dim myItem As Object 
 
 Dim myFolder As Folder 
 
 
 
 Set myNamespace = Application.GetNamespace("MAPI") 
 
 Set myFolder = myNamespace.GetDefaultFolder(olFolderInbox) 
 
 myFolder.Display 
 
 Set myItem = myFolder.Items(2) 
 
 myItem.Display 
 
End Sub

事件

名称
AfterWrite
AttachmentAdd
AttachmentRead
AttachmentRemove
BeforeAttachmentAdd
BeforeAttachmentPreview
BeforeAttachmentRead
BeforeAttachmentSave
BeforeAttachmentWriteToTempFile
BeforeAutoSave
BeforeCheckNames
BeforeDelete
BeforeRead
Close
CustomAction
CustomPropertyChange
转发
Open
PropertyChange
读取
ReadComplete
Reply
ReplyAll
Send
Unload
Write

方法

名称
AddBusinessCard
ClearConversationIndex
ClearTaskFlag
Close
Copy
删除
Display
转发
GetConversation
MarkAsTask
Move
PrintOut
Reply
ReplyAll
Save
SaveAs
Send
ShowCategoriesDialog

属性

名称
Actions
AlternateRecipientAllowed
应用程序
附件
AutoForwarded
AutoResolvedWinner
BCC
BillingInformation
Body
BodyFormat
类别
CC
Companies
Conflicts
ConversationID
ConversationIndex
ConversationTopic
CreationTime
DeferredDeliveryTime
DeleteAfterSubmit
DownloadState
EntryID
ExpiryTime
FlagRequest
FormDescription
GetInspector
HTMLBody
Importance
InternetCodepage
IsConflict
IsMarkedAsTask
ItemProperties
LastModificationTime
MarkForDownload
MessageClass
Mileage
NoAging
OriginatorDeliveryReportRequested
OutlookInternalVersion
OutlookVersion
Parent
权限
PermissionService
PermissionTemplateGuid
PropertyAccessor
ReadReceiptRequested
ReceivedByEntryID
ReceivedByName
ReceivedOnBehalfOfEntryID
ReceivedOnBehalfOfName
ReceivedTime
RecipientReassignmentProhibited
收件人
ReminderOverrideDefault
ReminderPlaySound
ReminderSet
ReminderSoundFile
ReminderTime
RemoteStatus
ReplyRecipientNames
ReplyRecipients
RetentionExpirationDate
RetentionPolicyName
RTFBody
Saved
SaveSentMessageFolder
Sender
SenderEmailAddress
SenderEmailType
SenderName
SendUsingAccount
Sensitivity
Sent
SentOn
SentOnBehalfOfName
Session
Size
Subject
Submitted
TaskCompletedDate
TaskDueDate
TaskStartDate
TaskSubject
To
ToDoTaskOrdinal
UnRead
UserProperties
VotingOptions
VotingResponse

另请参阅

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。