Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Get Outlook draft creation & last modified times
- $outlook = New-Object -ComObject outlook.application -Verbose:$false
- $namespace = $outlook.GetNameSpace( 'MAPI' )
- $draftsFolder = $namespace.GetDefaultFolder( [Microsoft.Office.Interop.Outlook.OlDefaultFolders]::olFolderDrafts )
- ## show all drafts
- $draftsFolder.items|select-object -property subject,creat*,last*
- ## show only email drafts
- $draftsFolder.items | where-object class -eq 43 | select-object -property subject,creat*,last*
- ## show edit time (warning: can be negative!)
- $draftsFolder.items | where-object class -eq 43 | select-object -property subject,creat*,last*,@{n='edit time';e={($_.LastModificationTime - $_.CreationTime).TotalSeconds -as [int]}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement