ContactItem 属性 (Outlook)ContactItem.LastModificationTime property (Outlook)

返回一个日期, 指定上次修改 Outlook 项目的日期和时间。Returns a Date specifying the date and time that the Outlook item was last modified. 此为只读属性。Read-only.

语法Syntax

expressionexpression. LastModificationTime

_表达式_一个代表ContactItem对象的变量。expression A variable that represents a ContactItem object.

备注Remarks

此属性对应于 MAPI 属性PidTagLastModificationTimeThis property corresponds to the MAPI property PidTagLastModificationTime.

示例Example

此 Visual Basic for Applications 示例使用**Items。 Restrict** 方法将筛选器应用于基于项目的LastModificationTime属性的联系人项目。This Visual Basic for Applications example uses the Items.Restrict method to apply a filter to contact items based on the item's LastModificationTime property. 您可以应用类似的方法来筛选其他 Outlook 项目的 LastModificationTime 属性。You can apply a similar approach to filter on the LastModificationTime property of other Outlook items.

Public Sub ContactDateCheck() 
 
 Dim myNamespace As Outlook.NameSpace 
 
 Dim myContacts As Outlook.Items 
 
 Dim myItems As Outlook.Items 
 
 Dim myItem As Object 
 
 
 
 Set myNamespace = Application.GetNamespace("MAPI") 
 
 Set myContacts = myNamespace.GetDefaultFolder(olFolderContacts).Items 
 
 Set myItems = myContacts.Restrict("[LastModificationTime] > '01/1/2003'") 
 
 For Each myItem In myItems 
 
 If (myItem.Class = olContact) Then 
 
 MsgBox myItem.FullName & ": " & myItem.LastModificationTime 
 
 End If 
 
 Next 
 
End Sub

以下 Visual Basic for Applications 示例除演示在筛选条件中使用变量外与上例相同。The following Visual Basic for Applications example is the same as the example above, except that it demonstrates the use of a variable in the filter.

Public Sub ContactDateCheck2() 
 
 Dim myNamespace As Outlook.NameSpace 
 
 Dim myContacts As Outlook.Items 
 
 Dim myItem As Object 
 
 Dim DateStart As Date 
 
 Dim DateToCheck As String 
 
 Dim myRestrictItems As Outlook.Items 
 
 
 
 Set myNameSpace = Application.GetNamespace("MAPI") 
 
 Set myContacts = myNameSpace.GetDefaultFolder(olFolderContacts).Items 
 
 DateStart = #01/1/2003# 
 
 DateToCheck = "[LastModificationTime] >= """ & DateStart & """" 
 
 Set myRestrictItems = myContacts.Restrict(DateToCheck) 
 
 For Each myItem In myRestrictItems 
 
 If (myItem.Class = olContact) Then 
 
 MsgBox myItem.FullName & ": " & myItem.LastModificationTime 
 
 End If 
 
 Next 
 
End Sub

另请参阅See also

创建 ContactItem 对象ContactItem Object

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.