SharingItem.LastModificationTime property (Outlook)
Returns a Date specifying the date and time that the SharingItem was last modified. Read-only.
Syntax
expression. LastModificationTime
expression A variable that represents a SharingItem object.
Remarks
This property corresponds to the MAPI property PidTagLastModificationTime.
Example
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. 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
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
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.