I recently needed to find out how many meetings I'd had with a specific company. I meet with over 30 different people at that company so it wasn't the easiest think to sort on. I tried the Calendar Analyzer and since I'm not good at using categories it wasn't as helpful as I liked. Enter PowerShell.
cls
Remove-Variable * -Force
Add-type -assembly "Microsoft.Office.Interop.Outlook" | out-null
$olFolders = "Microsoft.Office.Interop.Outlook.OlDefaultFolders" -as [type]
$outlook = new-object -comobject outlook.application
$namespace = $outlook.GetNameSpace("MAPI")
$folder = $namespace.getDefaultFolder($olFolders::olFolderCalendar)
foreach ($item in $folder.items)
{
foreach ($rec in $item.recipients)
{
if ($rec.Address -like '*COMPANYNAME*')
{
$out = $item.Subject + ';' + $item.Start + ';' + $item.Duration
$out
$out | Out-File c:\temp\calendar2.csv -Append
}
}
}
No comments:
Post a Comment