如何接受確認自動在PowerShell中的Outlook 我有腳本出口附件從Outlook電子郵件 - 見下 它正常工作在一臺PC上,但另一臺PC上有一個問題: 展望給出了消息,並希望回答:如何自動接受確認在PowerShell中的Outlook
Permit Denny Help
如果我手動點擊許可證或丹尼它工作正常。我想自動化它。 你能給我一些建議如何在PowerShell中做到這一點? 我試圖設置Outlook不給這個消息,但我沒有成功。 我的腳本:
# <-- Script --------->
# script works with outlook Inbox folder
# check if email have attachments with ".txt" and save those attachments to $filepath
# path for exported files - attachments
$filepath = "d:\Exported_files\"
# create object outlook
$o = New-Object -comobject outlook.application
$n = $o.GetNamespace("MAPI")
# $f - folder „dorucena posta「 6 - Inbox
$f = $n.GetDefaultFolder(6) # 6 - Inbox
# select newest 10 emails, from it olny this one with attachments
$f.Items| select -last 10| Where {$_.Attachments}| foreach {
# process only unreaded mail
if($_.unread -eq $True) {
# processed mail set as read, not to process this mail again next day
$_.unread = $False
$SenderName = $_.SenderName
Write-Host "Email from: ", $SenderName
# process all attachments
$_.attachments|foreach {
$a = $_.filename
If ($a.Contains(".txt")) {
Write-Host $SenderName," ", $a
# copy *.txt attachments to folder $filepath
$_.saveasfile((Join-Path $filepath "$a"))
}
}
}
}
Write-Host "Finish"
# <------ End Script ---------------------------------->