【发布时间】:2016-03-24 20:02:02
【问题描述】:
#file path
$filepath = “c:\test\”
#set outlook to open
$o = New-Object -comobject outlook.application
$n = $o.GetNamespace(“MAPI”)
#you'll get a popup in outlook at this point where you pick the folder you want to scan
$f = $n.pickfolder()
#date string to search for in attachment name
$date = Get-Date -Format yyyyMMdd
#now loop through them and grab the attachments
$f.Items | foreach {
$_.attachments | foreach {
Write-Host $_.filename
$a = $_.filename
If ($a.Contains($date)) {
$_.saveasfile((Join-Path $filepath $a))
}
}
}
任何人都可以帮助处理上述脚本,它实际上运行并写入主机,但附件没有出现在驱动器文件夹中,有什么想法吗?
谢谢
【问题讨论】:
标签: powershell outlook