如何在PowerShell for Outlook中自动接受确认

如何在PowerShell for Outlook中自动接受确认,powershell,outlook,Powershell,Outlook,如何在PowerShell for Outlook中自动接受确认 我有从Outlook导出电子邮件附件的脚本-请参阅下一步 它在一台电脑上正常工作,但在另一台电脑上是否存在问题: Outlook提供消息并希望得到答复: Permit Denny Help 如果我手动点击Permit或Denny,它会正常工作。我想把它自动化。 你能给我一些建议如何在PowerShell中实现它吗? 我已尝试将Outlook设置为不发送此消息,但

如何在PowerShell for Outlook中自动接受确认 我有从Outlook导出电子邮件附件的脚本-请参阅下一步 它在一台电脑上正常工作,但在另一台电脑上是否存在问题: Outlook提供消息并希望得到答复:

              Permit          Denny            Help
如果我手动点击Permit或Denny,它会正常工作。我想把它自动化。 你能给我一些建议如何在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 ---------------------------------->

如果Outlook的最新版本在本地系统上找不到最新的防病毒产品,则会显示安全提示


如果您仅限于PosikSead,不能使用C++或Delphi使用扩展MAPI,则是另一种选择。 $SenderName=$\ SenderName 真的,我不需要使用SenderName,我删除了这一行。 现在脚本工作正常,没有任何消息