我正在使用以下代码将outlook电子邮件附件和图像下载到文件夹中。但是它抛出了一个错误:不能索引到空数组。
你猜为什么?
$o = New-Object -ComObject outlook.Application
$ns = $o.GetNamespace("MAPI")
$f = $ns.Folders.Item(1)
$di = $f.Folders.item("Deleted Items")
$messagesWithAttachments = $di.items | Where-Object {$_.Attachments.Count -gt 0}
$messagesWithAttachments[0].Attachments.item(1).saveasfile("C:\test")发布于 2019-06-20 22:43:15
如果存在带有附件的电子邮件,请在saveasfile()方法中提供一个文件名,而不是文件夹。
例如:saveasfile("C:\test\test.txt")
https://stackoverflow.com/questions/56686458
复制相似问题