Last active
June 13, 2017 20:18
-
-
Save quonic/e1589852ba6a4a72842b225cbc2eebeb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Add-Type -assembly "Microsoft.Office.Interop.Outlook" | |
| $Outlook = New-Object -comobject Outlook.Application | |
| $namespace = $Outlook.GetNameSpace("MAPI") | |
| $i = 0 | |
| $j = 0 | |
| $topfolder = "" | |
| $inbox = "" | |
| $namespace.Folders | ForEach-Object { | |
| $i++ | |
| if($_.Name -like 'mailbox@example.com'){ | |
| $topfolder = $namespace.Folders.Item($i) | |
| #$namespace.Folders.Item($i) | |
| $topfolder.Folders | ForEach-Object { | |
| $j++ | |
| if($_.Name -like 'Inbox'){ | |
| $inbox = $topfolder.Folders.Item($j) | |
| } | |
| } | |
| } | |
| } | |
| $topfolder.Name | |
| $inbox.Items.Count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment