Playing with Journal Items & Outlook Object Model # 2

After created couple of journal items in my test lab, i thought this time i want to play around with the Journal items. Also i want to try the following programmatically:
1) iterate all the available journal items
2) Restrict the values with a (if the Lastmodificationtime > ‘23/9/2009’) specific time frame

For this i used Items(index). Here index is the index number of a journal entry or a value used to match the default property of a journal entry, to return a single JournalItem object from a Journal folder.

You can try this code snippet:

    '[Code Snippet: Outlook Object Model API & VBA]
    Dim myNamespace As Outlook.NameSpace
    Dim myJournal As Outlook.Items
    Dim myItems As Outlook.Items
    Dim myItem As Object
    Set myNamespace = Application.GetNamespace("MAPI")
    Set myJournal = myNamespace.GetDefaultFolder(olFolderJournal).Items
    Set myItems = myJournal.Restrict("[LastModificationTime] > '23/9/2009'")
    For Each myItem In myItems
        If (myItem.Class = olJournal) Then
            MsgBox myItem.Subject & ": " & myItem.LastModificationTime
        End If

Wow, thumbs_up you can find the results. Just you can juggle around with the relevant Restrict/Find with the items based on you requirement smile_wink

Happy programming!!