【发布时间】:2016-11-14 15:12:26
【问题描述】:
我想在运行获取电子邮件的 PowerShell 脚本之前更新(同步)收件箱文件夹(发送/接收),但我不知道如何操作。有没有办法从 powershell 做到这一点?
$matchString= "support@blabla.com";
$olFolderInbox = 6
$outlook = New-Object -COM Outlook.Application;
$mapi = $outlook.GetNameSpace("MAPI");
$inbox = $mapi.GetDefaultFolder($olFolderInbox)
$inbox.Items | where { $_.SenderEmailAddress -match $matchString } |
Select SenderEmailAddress,to,subject |
Format-Table -AutoSize
【问题讨论】:
-
您使用的是哪个版本的 Outlook?因为即使我能够运行 $mapi.SendAndReceive($false)
标签: powershell outlook powershell-3.0