在Exchange Web服务的帮助下,我们尝试将邮件移动到特定文件夹,然后将其标记为已读。为此,我们使用以下代码:
Write-Verbose "Move mail to '$('\PowerShell\' + $SQLTickets.ScriptName)'"
$DestinationPathID = Find-MailboxFolderIDHC @FindMailParams -Path ('\PowerShell\' + $SQLTickets.ScriptName)
$Mail.Move($DestinationPathID) | Out-Null
Write-Verbose 'Mark mails as read'
$Mail.IsRead = $true
$Mail.Update([Microsoft.Exchange.WebServices.Data.ConflictResolutionMode]::AutoResolve)
当我检查此操作的结果时,邮件确实已正确移动到文件夹en IsRead
属性设置为True
。但是,这在MS Outlook中不可见,但仍未标记为Read
。
当它到达这一行时:
$Mail.Update([Microsoft.Exchange.WebServices.Data.ConflictResolutionMode]::AutoResolve)
它抛出了我似乎无法解决的后续错误:
Exception calling "Update" with "1" argument(s): "The specified object was not found in the store."
答案 0 :(得分:0)
先将其标记为已读,然后将其像这样移动:
$Mail.IsRead = $true
$Mail.Update([Microsoft.Exchange.WebServices.Data.ConflictResolutionMode]::AutoResolve)
[VOID]$Mail.Move($DestinationPathID)