更新Outlook收件箱文件夹 [英] Update Outlook inbox folder
本文介绍了更新Outlook收件箱文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在运行此获取电子邮件的PowerShell脚本之前,我想更新(同步)收件箱文件夹(发送/接收),但是我不知道如何操作.有没有办法从Powershell做到这一点?
I would like to update (sync) the inbox folder (send/receive) before running this PowerShell script that gets the e-mails, but I don't know how. Is there a way to do this from 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
推荐答案
这是您的操作方式:
$ mapi.SendAndReceive($ false)
$mapi.SendAndReceive($false)
另外,对我来说,我需要在SendAndReceive之前使用Logon方法:
Also, for me I needed to use the Logon method before the SendAndReceive:
$ mapi.logon()
$mapi.logon()
这篇关于更新Outlook收件箱文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文