Your basic ITPro blog... What's going on at work, what I'm interested in.

Wednesday, April 22, 2009

When was an Outlook Calendar item created?

I had never been asked this question before, nor had I ever needed this information myself before.

Looking at the properties of an Outlook Calendar item, you can see the ‘Modified’ date/time. But, this isn’t necessarily the CREATION date/time. I couldn’t find a way to see this data from within the Outlook UI. So, I turned to PowerShell. I figured the value is there, I just needed to get to it.

** If you know of an easier way, please let me know.

This excellent blog post gave me most of what I needed.

From that, I created the following snippet that does the trick:

# Connect to Outlook Calendar
$outlook = New-Object -ComObject Outlook.Application
$session = $outlook.Session
$calendarItems = $outlook.session.GetDefaultFolder(9).Items
$calendarItems.IncludeRecurrences = $true

$filter = "[End] >= '4/19/2009' AND [Start] <= '4/22/2009'"

foreach ($appt in $calendarItems.Restrict($filter))
    $appt | Select CreationTime, LastModificationTime, Subject

At some point, I would like to make this into a function… accepting input for date ranges, etc.

Also, I want to figure out how to look at other people’s calendars. I am thinking I need to pass parameters to Logon(), but did not get my initial attempts to work.

Additional Info

My photo
email: support (AT) mangrumtech (DOT) com
mobile: 480-270-4332